有时候,命令从$PATH环境变量的一个路径移动到另一个路径时,执行命令,bash提示文件不存在。这是由于Bash有缓存机制。
Tobu:
bash
does cache the full path to a command. You can verify that the command you are trying to execute is hashed with thetype
command:$ type svnsync svnsync is hashed (/usr/local/bin/svnsync)To clear the entire cache:
$ hash -rOr just one entry:
$ hash -d svnsyncFor additional information, consult
help hash
andman bash
.
执行hash -d commands,清除该命令的缓存即可。
参考:
https://unix.stackexchange.com/questions/5609/how-do-i-clear-bashs-cache-of-paths-to-executables