[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PATH question



Tony Heal wrote:

I have a problem on one of my servers. The ‘ls’ command does not have the –h switch available. So as a workaround until I can determine what caused this and why I wanted to use the ‘ls’ file from another server. I copied /bin/ls from server # 2 onto server # 1 and tested it and it works fine, including the –h switch.

So I typed set, read the PATH and found that /usr/local/bin is in the path before /usr/bin. I thought I could simply drop the new ls in /usr/local/bin and the system would see it first when called and use it. WRONG.

So my questions are:

   1. why not?
   2. what is the order used in the path?

Thanks

Tony

You can use 'which' to find out which ls is being called, but it goes by first come first serve:
echo $PATH
/home/jeffd/bin:/usr/local/bin:/usr/bin:/bin
jeffd@proto:~$ touch ~/bin/ls
jeffd@proto:~$ chmod 755 ~/bin/ls
jeffd@proto:~$ which ls
/home/jeffd/bin/ls
jeffd@proto:~$ rm ~/bin/ls
jeffd@proto:~$ which ls
/bin/ls



Reply to: