## 35.7. PATH and path

For csh and zsh, 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 use setenv PATH (Section 35.6) in csh or export PATH in zsh, the shell modifies path accordingly. For example:

>     setenv PATH /bin:/usr/bin:/usr/local::$HOME/bin   csh
>     export PATH=/bin:/usr/bin:/usr/local::$HOME/bin   zsh

In PATH, an empty entry (`::`) stands for the current directory. The shells' path shell variable (Section 35.9) is the actual search list. Its syntax is slightly different; the list of directories is enclosed in parentheses ([XREF: UPT-ART-0508]), and the directories are separated by spaces. For example:

`~` Section 30.11

>     set path=(/bin /usr/bin /usr/local . ~/bin)   csh

>     path=(/bin /usr/bin /usr/local . ~/bin)       zsh

If you set the path shell variable, the shell will automatically set the PATH environment variable. You don't need to set both. Many people set the shell variable instead of the environment variable.

-- ML

Copyright © 2003 O'Reilly & Associates. All rights reserved.