diff options
Diffstat (limited to 'cmd/myshell')
| -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, " ")) } |