请知悉:本文最近一次更新为 6年 前,文中内容可能已经过时。

标准格式,注意,不要少了空格~

if空格[空格"xx"空格=空格"xx"空格];空格then
echo "if"
elif空格[空格"xx"空格=空格"xx"空格];空格then
echo "elseif"
else
echo "else"
fi

空格转为真实空格的代码:

if [ "xx" = "xx" ]; then
echo "if"
elif [ "xx" = "xx" ]; then
echo "elseif"
else
echo "else"
fi

判定参数方面可以参考:
shell中if判定的常用逻辑表示方式

shell中if判定的常用逻辑表示方式

相关参考网站:
https://blog.csdn.net/caoyongjunjava/article/details/44560849
https://www.jb51.net/article/34332.htm


如您从本文得到了有价值的信息或帮助,请考虑扫描文末二维码捐赠和鼓励。

尊重他人劳动成果。转载请务必附上原文链接,我将感激不尽。


与《shell脚本if elseif else整理》相关的博文:


留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌