diff options
| author | jet2tlf <jet2tlf@gmail.com> | 2024-05-30 02:24:56 +0000 |
|---|---|---|
| committer | jet2tlf <jet2tlf@gmail.com> | 2024-05-30 02:24:56 +0000 |
| commit | 408f2110ea96da62959c83c386b6c9a9db5cedae (patch) | |
| tree | 877f3ed36823b45a5eccb4a012aa0df50b8d79c1 /cmd | |
| parent | 922895b424bfd679aceda1ce9bf141aef1b64206 (diff) | |
| download | shell-go-408f2110ea96da62959c83c386b6c9a9db5cedae.tar.gz shell-go-408f2110ea96da62959c83c386b6c9a9db5cedae.zip | |
pass 4st stage
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/myshell/main.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/cmd/myshell/main.go b/cmd/myshell/main.go index 5626017..24f1fc4 100644 --- a/cmd/myshell/main.go +++ b/cmd/myshell/main.go @@ -18,14 +18,10 @@ func main() { fmt.Println(err.Error()) } - commands := strings.Split(in, " ") - - switch in { - case commands[0] == "exit": - n, err := strconv.Atoi(commands[1]) - os.Exit(n) + if in == "exit 0" { + os.Exit(0) + } else { + fmt.Printf("%s: command not found\n", strings.TrimRight(in, "\n")) } - - fmt.Printf("%s: command not found\n", strings.TrimRight(in, "\n")) } } |