shell学习篇之判断语句

一:判断语句

echo [ "aaa" ] && echo OK || echo notOk --条件判断如果[]成立就继续判断后面

判断条件:

if语句的简单使用;注意if判断中的大于等于/小于等于使用-ge/-le

判断/opt/tmp/apple.txt文件是否存在

二:if判断

if [ 条件 ]

then

程序

elif [ 条件判断 ]

then

程序

fi

猜你喜欢

转载自blog.csdn.net/qq_15076569/article/details/82120798