Customizing the search path for commands: The PATH variable
Command interpreters usually have to search for a file that contains the command you want to run. When you are using the shell, you tell the shell where to search for a command. Essentially, the shell uses a list of directories in which commands may be found. This list is specified in your PATH variable in your .profile file. The list could be called your search path, because it tells the shell where you want to search.
PATH='dir:dir:...'
For
example, you might enter: PATH='/bin:/usr/bin:/usr/etc:/usr/macneil/bin:/usr/games:/usr'
The
shell then searches the directories in the following order, when looking
for commands or shell scripts: - /bin
- /usr/bin
- /usr/etc
- /usr/macneil/bin
- /usr/games
- /usr
As soon as the shell finds a file with an appropriate name, it runs that file.
Because the shell runs a command as soon as it finds a file with an appropriate name, pay close attention to the order in which you list directory names in your search path. For example, the previous search path specifies the /bin directory (where z/OS® shell commands are stored) before the /etc directory.
If you set up your PATH incorrectly, you could get the wrong command. Always search the shell commands directory first: /bin. Some z/OS shell commands run other shell commands and utilities by name; they expect to get the z/OS UNIX version of that command and might not work correctly if a program that has the same name is found first in another directory.