PATH is an environment variable on operating systems like Linux, Windows which has specific set of directories where executable programs are located. According to your question, your executable script is placed under
$HOME/bin directory. So if you want to run a script which is not in PATH, you need to give full file structural path to let OS reach the file to execute it. For example,
If you do not want to give full file path all the time, you can put that file path in environment veritable using below command. Consedering, you have kept your script in
Above command will add your bin directory to the environmental path and then you can use
<nameofscript> from anywhere on the system.
Also, this will only work till the time your bash is running, if you try the same in new terminal, your PATH will change to default. To make it permanent, you need to add below line either in
To allow only root user to execute the
<nameofscript> from anywhere, you can either put in under