Linux判断
程序员文章站
2022-05-02 12:11:30
#字符串比较if [ "$1" == "判断条件" ] then echo "$1" elif [ "$1" == "判断条件" ] then echo "$1" else echo '[提示信息]' fi#数值比较int1 -eq int2 两数相等为真int1 -ne int2 两数不等为真in ......
#字符串比较
if [ "$1" == "判断条件" ] then echo "$1" elif [ "$1" == "判断条件" ] then echo "$1" else echo '[提示信息]' fi
#数值比较
int1 -eq int2 两数相等为真
int1 -ne int2 两数不等为真
int1 -gt int2 int1大于int2为真
int1 -ge int2 int1大于等于int2为真
int1 -lt int2 int1小于int2为真
int1 -le int2 int1小于等于int2为真