linux - -z 和 -o 命令在 Linux shell 脚本中意味着什么?

标签 linux bash shell unix command

我有一个 script.sh shell 脚本,其中我在一个函数中遇到了以下行:

if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; 

then
        ....

else
        ....

fi

我想知道 If 语句中的 -z-o 是什么意思

谢谢

最佳答案

其实很基础: -z 表示测试空字符串(零长度) -o 是或操作

如果您想在 bash 中编写脚本,我建议您阅读“Bash 初学者指南”。它将涵盖必要的基础知识,并且不会花费太多时间。

http://tldp.org/LDP/Bash-Beginners-Guide/html/

关于linux - -z 和 -o 命令在 Linux shell 脚本中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50225931/

相关文章:

linux - 如果列表不为空,list_empty 返回 1(非零)

bash - 执行包含来自 shell 变量的引号的命令

windows - svn 工作副本的快速递归 grepping

mysql - 通过 Shell 更新 Root 密码

linux - bash shell脚本中的最后一行命令是否将退出代码传递给父级?

linux - 绕过 bash 中的退出代码

linux - bash linux 中的 Ceil 只有 float

c - 某些程序在退出前无法从共享内存段分离后如何删除共享内存段?

linux - 使用 libtool 更改共享库的名称

json - jq:将嵌套对象添加到 JSON