Linux 拨号vps windows公众号手机端

shell if 如何取非

lewis 6年前 (2019-01-23) 阅读数 10 #程序编程
文章标签 shellif

在Shell脚本中,可以使用!操作符来取非。具体语法如下:

if ! condition; then
# code to be executed if the condition is false
else
# code to be executed if the condition is true
fi

在上述代码中,!操作符用于对condition进行取非操作。如果condition为true,则执行else后面的代码块;如果condition为false,则执行if后面的代码块。

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门