Shell Scripting: Saving Shell scripts

For example, if we have shell script named “” (with execute permission) we can make it run in the current working directory with the commands

$ sh (or)
$ ./

If the shell scripts are stored in an executable path, it will save us from typing extra keystrokes. To find the paths that are setup, type

$ echo $PATH
/usr/bin: /usr/local/bin

In order to achieve the desired results, You can
i) save the shell scripts under /usr/local/bin as that path is already listed in the system path
ii) create a folder and add the path to the system path variable

Create a directory “scripts” under /usr/local
$ mkdir/usr/local/scripts

Move the script “” to /usr/local/scripts

$ export PATH=$PATH:/usr/local/scripts

Now, type
and the shell script will execute as expected.

To set the path permanently, you have to edit .bashrc file.


Written by kurinchilamp

Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *