How to clear stale hashed search path in bash?

2

Previously my bash script was pointing to /path1 but I moved it to under /path2, now if I do "type myscript" it's still pointing to /path1, how do I solve this?

grokus

Posted 2010-08-09T14:21:12.957

Reputation: 235

See also http://unix.stackexchange.com/questions/86012/what-is-the-purpose-of-the-hash-command

– Ioannis Filippidis – 2014-08-09T01:01:16.820

Answers

4

I believe it's this:

hash -r

Telemachus

Posted 2010-08-09T14:21:12.957

Reputation: 5 695

I closed my bash session and started a new one and that solved the problem too. I thought I tried that before, but I could be wrong. – grokus – 2010-08-09T14:25:16.670

@grokus It's nice not to have to start a new shell - especially if you're logged in over ssh - but a new shell should do it. – Telemachus – 2010-08-09T14:27:50.793

@Telemachus, thanks. Next time I run into this, I will try "hash -r". – grokus – 2010-08-09T14:34:01.020

@Telemachus, can you vote my question up? I have more than 100 reputations on all other SE sites but not this one. It sucks to have 1 point, I can't even vote up anything. :( – grokus – 2010-08-09T14:36:01.753

1@grokus I'll vote it up, but you must promise to put the question back. Otherwise, this thread is getting awfully silly. (I currently have an answer in search of a question.) Also, can't you accept answers no matter what your point level is? (That gets you points as well.) – Telemachus – 2010-08-09T14:38:09.600

@grokus - Not related to this question, but FYI, if you've got more than 200rep on any SE site you should be due a +100 bonus. You need to unlink this account, then goto the site with >200 and relink - see here.

– DMA57361 – 2010-08-09T14:38:40.553

@Telemachus. Done. Sorry about that. – grokus – 2010-08-09T15:10:12.613

@DMA57361, thanks for the link. I will try that. – grokus – 2010-08-09T15:10:30.807