aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjet2tlf <jet2tlf@gmail.com>2024-05-30 02:04:04 +0000
committerjet2tlf <jet2tlf@gmail.com>2024-05-30 02:04:04 +0000
commit962c7496ed455f534ffab7bf48306652fd2d14e7 (patch)
tree4091282dc721601adcefa4fb83432a875b921eb0
parent705f9c214695df293fc68bac774e45815858dabc (diff)
downloadshell-go-962c7496ed455f534ffab7bf48306652fd2d14e7.tar.gz
shell-go-962c7496ed455f534ffab7bf48306652fd2d14e7.zip
pass 2st stage
-rw-r--r--cmd/myshell/main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/myshell/main.go b/cmd/myshell/main.go
index f5c858a..cebcdd0 100644
--- a/cmd/myshell/main.go
+++ b/cmd/myshell/main.go
@@ -4,11 +4,17 @@ import (
"bufio"
"fmt"
"os"
+ "strings"
)
func main() {
fmt.Fprint(os.Stdout, "$ ")
// Wait for user input
- bufio.NewReader(os.Stdin).ReadString('\n')
+ in, err := bufio.NewReader(os.Stdin).ReadString('\n')
+ if err != nil {
+ fmt.Fprintf(err.Error())
+ }
+
+ fml.Fprintf("%s: command not found\n", strings.TrimRight(in, "\n"))
}