shell条件语句
发布时间:2020-12-15 21:38:31 所属栏目:安全 来源:网络整理
导读:if (表达式); 语句1 elif 语句2 else fi ? if(())用户判断大小 #!/bin/ bash#auto if testNUM = 100 NUM1 = 200 if (($NUM$NUM1)); then echo " this $NUM greate $NUM1 " else echo " this $NUM XIAOU $NUM1 ? 逻辑运算符解析: -f ?判断文件是否存在 -d判
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 ? 逻辑运算符解析: -d判断目录是否存在 -gt 大于 -z 空字符串 [email?protected]:/home/yisheng/shell# /bin/bash -n 5.sh [email?protected]-v-m:/home/yisheng/shell# -n用于测试代码是否正确,无输出为正确 ? #!/bin/bash #by hou 2019 DIR=/tmp/2019 if [ ! -d $DIR ];then mkdir -p $DIR echo -e " |