aboutsummaryrefslogtreecommitdiff
path: root/cmd/myshell
diff options
context:
space:
mode:
authorjet2tlf <jet2tlf@gmail.com>2024-05-31 04:41:13 +0000
committerjet2tlf <jet2tlf@gmail.com>2024-05-31 04:41:13 +0000
commitf37141ac0b2905b07f7a060852ea6a302b1fd527 (patch)
treeb417a1341e39ab374fde263d9d266742b618443a /cmd/myshell
parent2459b1ed756af79334e08dcc09f9db1998c20f8c (diff)
downloadshell-go-f37141ac0b2905b07f7a060852ea6a302b1fd527.tar.gz
shell-go-f37141ac0b2905b07f7a060852ea6a302b1fd527.zip
pass 9st stage
Diffstat (limited to 'cmd/myshell')
-rw-r--r--cmd/myshell/main.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/myshell/main.go b/cmd/myshell/main.go
index 7847553..c4bb372 100644
--- a/cmd/myshell/main.go
+++ b/cmd/myshell/main.go
@@ -30,6 +30,8 @@ func main() {
Echo(command[1:])
case "type":
Type(command[1])
+ case "pwd":
+ Pwd()
default:
executable := exec.Command(command[0], command[1:]...)
executable.Stderr = os.Stderr
@@ -43,6 +45,16 @@ func main() {
}
}
+func Pwd() {
+ dir, err := os.Getwd()
+
+ if err != nil {
+ fmt.Println(err.Error())
+ }
+
+ fmt.Println(dir)
+}
+
func Echo(message []string) {
fmt.Println(strings.Join(message, " "))
}