- 主题:请教一个搜索文件的问题
比如我build了一个叫abc的可执行程序,然后放到 /usr/local/bin/下面,但是这时候直接用 abc,提示找不到。(重新登录进来就能找到)
想请教一下有什么方法可以当时就能找到并运行呢。
--
FROM 14.16.155.*
你说的情况不应该出现。如果/usr/local/bin/在path里,当时就能找到。如果不在,重新登录也没用。
【 在 il15 (il15) 的大作中提到: 】
: 比如我build了一个叫abc的可执行程序,然后放到 /usr/local/bin/下面,但是这时候直接用 abc,提示找不到。(重新登录进来就能找到)
: 想请教一下有什么方法可以当时就能找到并运行呢。
--
FROM 116.233.73.*
是的,我也很纳闷,/usr/local/bin 确实在path里面。
我用的是centos8,csh。不知道我是不是改了什么配置,但是觉得也不应该。
【 在 RuralHunter 的大作中提到: 】
: 你说的情况不应该出现。如果/usr/local/bin/在path里,当时就能找到。如果不在,重新登录也没用。
:
--
FROM 14.16.155.*
zsh需要输个rehash,csh大概也是吧
--
FROM 112.17.247.*
对的:
The Unix C shell hashes your search path directories to help it find executables faster. But it develops blind spots if you add new executables to those directories after it's already done its hash. The solution is to use the rehash command to tell it to rebuild its hash. Alternately, you can turn off the path hash entirely (taking a slight performance hit) using the unhash command.
【 在 freesand (freesand) 的大作中提到: 】
: zsh需要输个rehash,csh大概也是吧
--
FROM 116.233.73.*
多谢两位!
话说我如果事先不知道这个feature的话,我怎么可以搜索出来呢?
【 在 RuralHunter 的大作中提到: 】
: 对的:
: The Unix C shell hashes your search path directories to help it find executables faster. But it develops blind spots if you add new executables to those directories after it's already done its hash. The solution is to use the rehash command to tell it to rebuild its hash. Alternately, you can turn off the path hash entirely (taking a slight performance hit) using the unhash command.
:
--
FROM 14.16.155.*