11.10. Storing Scripts
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 11.47.
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 ...
Get Linux Shells by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.