Note that this is not a duplicate. I am asking about disabling the cache, not clearing it. If you have a cache to clear, then it is obviously not disabled.
On the rare occasions that I notice bash's cache of things that it has found in the path, it's not because it's helpful, it's because it's bloody annoying. An example:
~ dc$ export PATH=$HOME/bin:$PATH ~ dc$ cat bin/which #!/bin/bash echo "my which" ~ dc$ which my which ~ dc$ rm bin/which ~ dc$ which which -bash: /Users/dc/bin/which: No such file or directory
In another shell ...
~ dc$ which which /usr/bin/which
I'm sure that this caching made sense back in the good old days when disks were slow and memory was expensive and limited and so you couldn't cache much - caching a path is cheaper than caching all the disk blocks necessary to find a command. But these days it provides no noticeable benefit and causes more problems than it solves. It's a misfeature, verging on being a bug.
And I can't even find a way of disabling it. Any pointers?