标签:style col 存在 判断目录 this color The class roo
if (表达式);
语句1
elif
语句2
else
fi
if(())用户判断大小
#!/bin/bash #auto if test NUM=100 NUM1=200 if (($NUM>$NUM1));then echo "this $NUM greate $NUM1 " else echo "this $NUM XIAOU $NUM1
逻辑运算符解析:
-f 判断文件是否存在
-d判断目录是否存在
-gt 大于
-z 空字符串
root@yisheng-v-m:/home/yisheng/shell# /bin/bash -n 5.sh root@yisheng-v-m:/home/yisheng/shell#
-n用于测试代码是否正确,无输出为正确
#!/bin/bash #by hou 2019 DIR=/tmp/2019 if [ ! -d $DIR ];then mkdir -p $DIR echo -e "\033[32mthis $DIR create success!\033[0m" else echo -e "\033[32mthis $DIR exit!\033[0m" fi
判断目录是否存在
标签:style col 存在 判断目录 this color The class roo
原文地址:https://www.cnblogs.com/fbjtcp/p/10927090.html