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

PATH question



On Thu, 15 Mar 2007 Tony Heal <theal@pace2020.com> asked:
>
> 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?
>
I've been bitten by this myself and somebody on the fido linux list
showed me the light years ago.
Bash remembers each command you issue and keeps the path in a hash
so the next time you use the command the path is already known.
>From the command line enter 'help hash' for further elucidation.
So 'hash ls' is required to reset bash's memory of where 'ls' is in
each instance of bash that has already executed 'ls'. If you have 
several vts open each instance of bash has it's own hash of commands.
>
> 2.	what is the order used in the path?
>
As expected, left to right as printed by the command 'echo $PATH' for
new searches.

Enjoy,
Mike



Reply to: