为什么与我得到的效果不匹配?

为什么与我得到的效果不匹配?

我无法解释以下行为:

[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.

为什么非限定的 gmake 与 给出的不匹配which?请注意,我在 /usr/bin/gmake 中有 v3.80。这是在 64 位版本 Centos 4 上的 bash 中。

答案1

gmake因为 bash在其哈希查找表中的其他地方具有位置。

# 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

相关内容