[PLUG] Way to disable command hashing in bash?

Mayuresh mayuresh at acm.org
Sun Apr 11 19:08:21 IST 2010

On Sat, Apr 10, 2010 at 08:57:16PM +0530, Kulkarni Shantanu wrote:
> * Mayuresh <mayuresh at acm.org> [100410 19:58]:
> > Now the "solutions" I know and am not particularly happy with are:
> > 
> > 1. Use hash -r to remove the cache.
> > 
> > 2. Open a new session every time you check out, so that you begin with
> > empty cache.
> > 
> > 3. Write a script for check-out operation that will empty the cache.
> > 
> > Rather, I am looking for a way that will disable caching completely and I
> > won't have to remember to do any manual operation if I check out the
> > program.
> > 
> I do not have an exact answer, but have thought of aliases.
> You may want something on lines of,
> alias cmd=/dev/cmd
> This will ensure /dev/cmd is executed always. But do read this before,
> http://www.gnu.org/software/bash/manual/html_node/Aliases.html#Aliases
> Even functions might do. Please see,
> http://www.gnu.org/software/bash/manual/html_node/Command-Search-and-Execution.html#Command-Search-and-Execution
> I do not have access to bash 4 and so cannot find the exact solution.
> Do keep us posted on results.
> Shantanu
> www.shantanukulkarni.org

On a development setup, there may be several such programs and over a
period of time they would keep growing. So aliases or functions are not so
convenient. In comparison, wrapping the check out operation into a script
that empties cache (option 3 in my mail) looks better i.e. easier to live
with and maintain.

However, ideally, there should have been a way with bash to disable
caching that would generally seem to be a smart behavior though really
annoying in such situations.  Seems there isn't a way to do so as of now


More information about the Plug-mail mailing list