On 3/14/14 12:11 PM, Reuben Thomas wrote:
> Tested in bash 4.3.
> 
> $ foo
> ... a command is run
> $ hash
> hits command
>    0 /home/rrt/bin/foo
> $ rm `which foo`
> $ which foo
> /usr/bin/foo
> $ foo
> bash: /home/rrt/bin/foo: No such file or directory
> 
> Why doesn't bash just remove the hashed path and do a normal PATH search? I
> have to remove it manually.

Look at the description of the `checkhash' option to `shopt'.  It does what
you want; it's just not the default.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to