问题描述
我遇到了在 .zshrc 中加载 nvm 环境的命令,但我不知道它对标志 -s 的作用到底是什么。我知道方括号是检查此命令中的文件夹是否存在的条件。但不知道 -s 是做什么的。
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
有人知道这个命令中的标志 -s 吗?提前致谢。
解决方法
[
与 test
相同。检查 test
的联机帮助页:
-s file True if file exists and has a size greater than zero.
更新:实际上,使用 man '['
也有效。