2
1
I am aware of the bash internal command hash and how one can use hash -d or hash -r to forget remembered locations. Is there a way to instruct bash to automatically do this whenever it gets a "cache miss", i.e. when the remembered location goes away (no such file or directory) bash would clear the remembered location and try again?
1The cost of the test is relevant (each disk access == latency), but you are comparing that cost to the cost of searching the entire PATH for the file. Seems cheap for providing the feature the requester wanted. – Slartibartfast – 2014-03-27T05:55:27.983
1@slartibartfast: agreed. As I said, the cost is probably not significant. – rici – 2014-03-27T06:10:55.700
Thanks, this is exactly what I wanted. I wonder if there are Linux dists with this option set as the default? – Gerry Lufwansa – 2014-03-27T06:17:35.343
@GerryLufwansa: I doubt it, but it hardly seems like a deciding feature for a selecting a distro. It's just one line to add to your bash startup file (although figuring out which file can be a challenge with some distributions). – rici – 2014-03-27T18:50:45.123