Operating System - HP-UX
1827807 Members
2757 Online
109969 Solutions
New Discussion

which program will execute

 
SOLVED
Go to solution
Henry Chua
Super Advisor

which program will execute

Hi Guys

Just curious, say I have a shell script "kk.sh", if I have it in /bin, and another in /usr/bin and other paths..all different...which one will be executed if i run it in root shell? what is the hierachical tree for program execution?
3 REPLIES 3
Solution

Re: which program will execute

Henry:

Type:

echo $PATH

from ypur shell prompt - this will give you a : delimited list of your seach path when attempting to execute a script/executable etc.

A quick way to find out which one will run is to type:

which kk.sh

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Biswajit Tripathy
Honored Contributor

Re: which program will execute

# echo $PATH
This should give you the sequence of the paths that
is used to search the executable if you are not using
the absolute path. If your $PATH looks like following

/bin:/usr/bin/:.

then /bin/kk.sh will be executed.

- Biswajit
:-)
Henry Chua
Super Advisor

Re: which program will execute

thanks guys!!