z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Adding your working directory to the search path

z/OS UNIX System Services User's Guide
SA23-2279-00

You can have the shell search your working directory for commands (in addition to the standard directories that contain commands). As an example, suppose you have different directories containing the source code for different programs. In each directory, you create a shell script named compile that compiles all the source modules of the program in that directory. To compile a particular program, enter cd to change to the appropriate directory and then enter:
compile
The shell searches the working directory, finds the compile shell script, and runs it.
You can add your working directory to your search path by one of these methods:
  • Putting in an entry without a name
  • Using a period (.) for the working directory.
For example, both of these specify that the working directory should be searched after /bin but before /usr/local:
PATH='/bin::/usr/local'    #no name
PATH='/bin:.:/usr/local'   #using a period
Both of these say that your working directory should be searched before anything else:
PATH=':/bin:/usr/local'    #no name
PATH='.:/bin:/usr/local'   #using a period
Both of these say that your working directory should be searched after everything else:
PATH='/bin:/usr/local:'    #no name, ends in a colon
PATH='/bin:/usr/local:.'   #using a period

The best way to specify search paths is to put them into your .profile file. That way, they are set up every time you log into the shell.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014