Adding your working directory to the search path
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.
setenv path '/bin::/usr/local' #no name
setenv path '/bin:.:/usr/local' #using a period
Both of these
say that your working directory should be searched before anything
else:
setenv path ':/bin:/usr/local' #no name
setenv path '.:/bin:/usr/local' #using a period
Both of these
say that your working directory should be searched after everything
else:
setenv path '/bin:/usr/local:' #no name, ends in a colon
setenv path '/bin:/usr/local:.' #using a period
The best way to specify search paths is to put them into your .tcshrc file. That way, they are set up every time you log into the shell.