diff options
| author | jet2tlf <jet2tlf@gmail.com> | 2024-05-30 02:21:58 +0000 |
|---|---|---|
| committer | jet2tlf <jet2tlf@gmail.com> | 2024-05-30 02:21:58 +0000 |
| commit | d2e1a51ddb38942a5e24829a672712388bd8b8c1 (patch) | |
| tree | 261ab1d212b411a08add1051f17228db20d857b0 | |
| parent | 4a9731f352df928fba1e0701397259002f0caf43 (diff) | |
| download | shell-go-d2e1a51ddb38942a5e24829a672712388bd8b8c1.tar.gz shell-go-d2e1a51ddb38942a5e24829a672712388bd8b8c1.zip | |
pass 4st stage
| -rw-r--r-- | cmd/myshell/main.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/myshell/main.go b/cmd/myshell/main.go index cbb2f14..6d591ab 100644 --- a/cmd/myshell/main.go +++ b/cmd/myshell/main.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "strings" + "strconv" ) func main() { @@ -20,8 +21,8 @@ func main() { commands := strings.Split(in, " ") switch in { - case commnds[0] == "exit": - os.Exit(commands[1].ToInt()) + case commands[0] == "exit": + os.Exit(strconv.Atoi(commands[1])) } fmt.Printf("%s: command not found\n", strings.TrimRight(in, "\n")) |