some problems when commands are hashed

In Unix systems, commands are hashed for performance reasons [man hash]. Today, I got a problem related to this and wasted so much time for resolving. In my solaris machine, patch command is in /usr/bin/patch and its version is very old. So, I have installed a new patch version using pkgadd and it has installed patch command in /usr/local/bin/. In PATH variable, /usr/local/bin/ is before /usr/bin directory.  So, `which patch` command is showing /usr/local/bin/patch. But, when I execute patch on command prompt, it is executing old version of patch [/usr/bin/patch]. After some time, I tried type command `type patch` and it is showing /usr/bin/patch is hashed. Then, I came to know about hash command in solaris. After rehashing, every thing started working fine.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: