diff options
| author | jet2tlf <jet2tlf@gmail.com> | 2024-05-31 04:41:13 +0000 |
|---|---|---|
| committer | jet2tlf <jet2tlf@gmail.com> | 2024-05-31 04:41:13 +0000 |
| commit | f37141ac0b2905b07f7a060852ea6a302b1fd527 (patch) | |
| tree | b417a1341e39ab374fde263d9d266742b618443a | |
| parent | 2459b1ed756af79334e08dcc09f9db1998c20f8c (diff) | |
| download | shell-go-f37141ac0b2905b07f7a060852ea6a302b1fd527.tar.gz shell-go-f37141ac0b2905b07f7a060852ea6a302b1fd527.zip | |
pass 9st stage
| -rw-r--r-- | cmd/myshell/main.go | 12 |
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, " ")) } |