【发布时间】:2020-05-30 13:06:17
【问题描述】:
使用一些相对或绝对路径编写命令hash,无论是文件、目录还是无处,它似乎什么都不做。
$> hash /bin/ls
prints nothing ***
$> hash /path/to/nowhere
prints nothing ***
$> hash ../same/as/above
same thing ***
这是为什么呢?
【问题讨论】:
-
您期待什么?
hash foo只是让 shell 记住foo解析的内容,这样它就不必在每次运行foo时执行路径查找。 -
我知道,“
hash foo”返回消息hash: foo: not found。但是当涉及到路径时,它什么也不返回
标签: bash shell unix hash terminal