我读了`which`,但我无法真正理解其中的区别。我在 64 位 debian-buster 上运行 zsh 5.4.2。which 和 wherece 都是 shell-builtins 。
人们能否指出哪里比哪一个更合适,反之亦然?
/home/shirish> zsh --version
zsh 5.4.2 (x86_64-debian-linux-gnu)
/home/shirish> type -a which
which is a shell builtin
which is /usr/bin/which
which is /bin/which
/home/shirish> type -a whence
whence is a shell builtin
Run Code Online (Sandbox Code Playgroud)
Sté*_*las 18
which是一个 csh 命令(以及csh读取您的 的脚本~/.cshrc),whence是 Korn shell 对csh's的回答which,typeBourne shell的回答,command -v/VPOSIX的回答...
zsh使用一些扩展实现ksh's whence,但也为whichcsh 瘾君子和type/command -v/V为 POSIX 合规性提供了一个别名,它们只是相同的命令,但具有不同的默认行为。
which是whence -c(c对于csh)type是whence -v(更详细whence)where 是 whence -cacommand -v就像whencecommand -V就像whence -v| 归档时间: |
|
| 查看次数: |
4805 次 |
| 最近记录: |