Reputation: 171
I have used export before but I don't know why when I set the variable PATH to any directory this time, ls, awk commands are not found but no problem with pwd, cd
export PATH="/Users/carolW/Desktop"
ls
-sh: ls: command not found
Upvotes: 1
Views: 2598
Reputation: 780984
Use:
export PATH=/Users/carolW/Desktop:$PATH
You're removing all the normal directories from your path, so it only looks in your Desktop folder for everything. You just want to add your directory, not replace the entire path with it.
Upvotes: 2
Reputation: 5703
most probably because pwd and cd are built shell command (you can test: which pwd which ls ) However, ls are such are tools you can find in /bin directory or such, and those paths are defined in your variable PATH. If you clear the variable PATH, most likely you won't find your tool anymore.
You may use export PATH=$PATH:"/Users/carolW/Desktop" So that you concatenate your path to the already existing paths
Upvotes: 0