Saturday, January 23, 2010

How to run a unix shell script from any directory

To run a script from anywhere inside UNIX directory, you need to include the script absolute directory in the PATH variable. After that without using the pathname we can execute the script successfully.

eg:
In .profile, update PATH=$PATH:/home/sujay/scripts and source the .profile

Script Loc: /home/sujay/scripts/
Script Name; anywhere

sujay@laptop:~$ anywhere
++ pwd
+ echo 'Executed from /home/sujay'
Executed from /home/sujay

1 comment:

Sandeep SEO said...

Thank you very much. The post was long, but I loved to read it till the last word. It was so nice blog and useful to Informatics learners................for more information about Fusion Cloud Financials Training Centre can Click Here.