Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 6.4 The PATH Environment Variable Chapter 6
Shell and Environment Variables
Next: 6.6 The TZ Environment Variable

6.5 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 (6.4), 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 (6.8, 6.9) is the actual search list. Its syntax is slightly different; the list of directories is enclosed in parentheses (47.5), 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

Previous: 6.4 The PATH Environment Variable UNIX Power ToolsNext: 6.6 The TZ Environment Variable
6.4 The PATH Environment Variable Book Index6.6 The TZ Environment Variable

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System