01-26-2005
405,
3
Join Date: Dec 2000
Last Activity: 21 May 2012, 6:37 PM EDT
Location: Greater Dallas area
Posts: 405
Thanks Given: 0
Thanked 3 Times in 3 Posts
It has nothing at all to do with $HOME not being in $PATH, well unless the script is in $HOME.
UNIX uses an environment variable $PATH as a colon delimited list to define directories to be searched for commands entered into the shell. If $PATH is st to /usr/bin only, when you type ls, it looks in /usr/bin for something called ls, then tries to execute it. If ls is not in /usr/bin, it returns a file not found error.
Typically the path is set to a limited number of directories to make searches quick. If you want to exectute something not in a directory in $PATH, you have to specify the path to it. You can do this explicitely from root (example: /usr/bin/ls ), relative to where you are ( cd / ; usr/bin/ls ), or if it is in the directory you are in, with ./ ( cd /usr/bin ; ./ls ).
You may also use ./ if you want to use a specific version of a program. Say there are two ps commands, one in /usr/bin, the other in /usr/ucb/bin/ps. You want to use the latter, you can type the full path, or cd to /usr/ucb/bin, then run ./ps