Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.