After creating successful scripts, it is customary to collect them in a common script directory and change your path so that the scripts can be executed from any location. Example 10.50. 1 % mkdir ~/bin 2 % mv myscript ~/bin 3 % vi .login (In .login reset the path to add ~/bin.) 4 set path = ( /usr/ucb /usr /usr/etc ~/bin . ) 5 (At command line) % source .login EXPLANATION -
Make a directory under your home directory called bin , or any other name you choose. -
Move any error-free scripts into the bin directory. Putting buggy scripts here will just cause problems. -
Go into your .login file and reset the path. -
The new path contains the directory ~/bin , which is where the shell will look for executable programs. Because it is near the end of the path, a system program that may have the same name as one of your scripts will be executed first. -
By sourcing the .login , the path changes are affected; it is not necessary to log out and back in again. |