aboutsummaryrefslogtreecommitdiff
path: root/cmd/myshell
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/myshell')
-rw-r--r--cmd/myshell/main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/myshell/main.go b/cmd/myshell/main.go
index c4bb372..19242e9 100644
--- a/cmd/myshell/main.go
+++ b/cmd/myshell/main.go
@@ -45,6 +45,12 @@ func main() {
}
}
+func Cd(dir string) {
+ if err := os.Chdir(dir); err != nil {
+ fmt.Fprintf(os.Stdout, "%s: No such file or directory\n", dir)
+ }
+}
+
func Pwd() {
dir, err := os.Getwd()