Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检查 OSX 上的 bash 脚本中是否存在输入参数。我愿意:
if [-z "$1"]
我得到:
/usr/local/bin/deploy.sh: line 8: [-z: command not found
有小费吗?
谢谢。
您需要在条件周围留一个空间:
if [ -z "$1" ] ^ ^