PATH and path
For the C shell, it's slightly incorrect to say that PATH contains the search list for commands. It's a bit more complicated. The PATH environment variable is used to set the path shell variable; that is, whenever you setenv PATH (), the C shell modifies path accordingly. For example:
setenv PATH /bin:/usr/bin:/usr/local::$HOME/bin
In PATH, an empty entry (::
) stands for the current directory. The C shell's path shell variable (, ) is the actual search list. Its syntax is slightly different; the list of directories is enclosed in parentheses (), and the directories are separated by spaces. For example:
~ |
set path=(/bin /usr/bin /usr/local . ~/bin) |
---|
If you set the path shell variable, the C shell will automatically set the PATH environment variable. You don't need to set both. Many people use a set path command instead of setenv PATH.
- ML