Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cannot explain the following behavior:

[centos4x64 ~] /usr/local/bin/gmake --version
GNU Make 3.82
Built for x86_64-unknown-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[centos4x64 ~] which gmake
/usr/local/bin/gmake

[centos4x64 ~] gmake --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Why doesn't the unqualified gmake match the one given by which? Note that I have v3.80 in /usr/bin/gmake. This is in bash on a 64 bit version Centos 4.

share|improve this question
up vote 2 down vote accepted

Because bash has the location of gmake as being somewhere else in its hash lookup table.

# list the path to the binary that invoking 'gmake' will call
hash -t gmake 
# have bash forget the mapping for 'gmake'
hash -d gmake
# have bash remember the correct mapping for 'gmake'
hash -p /usr/local/bin/gmake gmake
# or just
gmake
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .