Problem with PATH

On one of the machines at work, we had Net-SNMP 5.2.3 installed, and I wanted to upgrade that to 5.4.2.1. So I downloaded the tar file, extracted it, did the configure, make, make test, make install, and everything worked.

All the executable files (like snmpget, snmpset, snmpwalk) got copied to /usr/local/bin, which is good, but there seems to be a problem with the PATH.

When I type "env", I see that my PATH is set to the following:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

And the only files in /usr/local/sbin are snmpd and snmptrapd.

When I run "snmpget --version", it says:
NET-SNMP version: 5.2.3

But when I run "/usr/local/bin/snmpget --version", it says:
NET-SNMP version: 5.4.2.1

When I run "which snmpget", it says:
/usr/local/bin/snmpget

Huh? This makes no sense to me. If the "which" command says I will be running the snmpget in /usr/local/bin, then why does the "snmpget --version" command indicate that it's running the older version from somewhere else?

---------- Post updated at 02:59 PM ---------- Previous update was at 02:10 PM ----------

OK I fixed the problem by rebooting the system. I didn't think it'd be like Windows where you have to reboot after installing something...

Usually, rebooting is the last measure you should take. Modern shells normally create a lookup table for commands, so that the path doesn't have to be searched every time. If you install a program in a different path, but with the same name, the old lookup entry (hash) still points to the old program.

Depending on your shell, you can make it forget it's lookup entries using 'rehash' or 'hash -r'. And even if that doesn't work, closing the shell and/or opening a new one (logging out and logging in) should have the same effect.