For example, if we have shell script named “myshellscript.sh” (with execute permission) we can make it run in the current working directory with the commands
$ sh myshellscript.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
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
Move the script “myshellscript.sh” to /usr/local/scripts
$ export PATH=$PATH:/usr/local/scripts
and the shell script will execute as expected.
To set the path permanently, you have to edit .bashrc file.