diff options
| -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")) } } |