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

Re: File path caching?



On Sun, Aug 30, 1998 at 10:34:24AM +0200, Ole J. Tetlie wrote:
<snip>
> | 
> | Can anyone explain why this happens?
> 
> Yes. You are encountering what is called a the command hash table.
> 
> Let's say you type 'fred'. If your shell (bash?) were to search all
> the directories in your path it could take a long time for each command.
> Bash solves this by keeping a hash table of previous commands. Then,
> whenever you type 'fred', bash first has a look in the table to see if it
> has found that command earlier. If it has, then it uses the same file
> again, and doesn't bother looking for others.
> 
> You can see what's in the table with the builtin command 'hash'.
> What you need to do is to type 'hash -r', which clears the table. This
> will allow bash to search for 'fred' in the path, not in the hash table.
> 
> -- 
> .elOle.


Ahh...thanks.  Mind you, you'd think that if the bash couldn't find the file
that was in it's hash lookup, then it would try the full path again rathar
than reporting file not found.

Thanks again,

Chris

-- 

-------------------------------------------------------------------
REALITY.SYS corrupted: Reboot universe? (Y/N/Q) ...Debian GNU/Linux
-------------------------------------------------------------------
Reply with subject 'key' for PGP public key.  KeyID A9E087D5

Attachment: pgpAdHo8jowro.pgp
Description: PGP signature


Reply to: