ILD

Bash clear commands path cache
作者:Herbert Yuan 邮箱:yuanjp@hust.edu.cn
发布时间:2018-1-11 站点:Inside Linux Development

有时候,命令从$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 the type command:

$ type svnsync
svnsync is hashed (/usr/local/bin/svnsync)

To clear the entire cache:

$ hash -r

Or just one entry:

$ hash -d svnsync

For additional information, consult help hash and man bash.


执行hash -d commands,清除该命令的缓存即可。


参考:

https://unix.stackexchange.com/questions/5609/how-do-i-clear-bashs-cache-of-paths-to-executables



Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.