aboutsummaryrefslogtreecommitdiff
path: root/cmd/myshell
diff options
context:
space:
mode:
authorjet2tlf <jet2tlf@gmail.com>2024-05-30 02:24:56 +0000
committerjet2tlf <jet2tlf@gmail.com>2024-05-30 02:24:56 +0000
commit408f2110ea96da62959c83c386b6c9a9db5cedae (patch)
tree877f3ed36823b45a5eccb4a012aa0df50b8d79c1 /cmd/myshell
parent922895b424bfd679aceda1ce9bf141aef1b64206 (diff)
downloadshell-go-408f2110ea96da62959c83c386b6c9a9db5cedae.tar.gz
shell-go-408f2110ea96da62959c83c386b6c9a9db5cedae.zip
pass 4st stage
Diffstat (limited to 'cmd/myshell')
-rw-r--r--cmd/myshell/main.go12
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"))
}
}