当寻找的路径,可执行文件或检查,如果你在Unix shell中输入命令的名称会发生什么,有不同的公用事业过多(which,type,command,whence,where,whereis,whatis,hash,等)。
我们经常听说which应该避免。为什么?我们应该用什么来代替?
$ which echo
echo: shell built-in command.
$ which ls
/bin/ls
$ which cat
/bin/cat
Run Code Online (Sandbox Code Playgroud)
为什么回声不喜欢一个独立的工具ls,ps,cat等?为什么它是特定于外壳的?有什么好的理由吗?