baobaozai 2020-06-11
#!/bin/bash NUM1=20 NUM2=10 if (($NUM1 > $NUM2)); then echo "This $NUM1 greate $NUM2 !" else echo "This $NUM1 Little $NUM2 !" fi
#!/bin/bash DIR=/tmp/20200603 if [ ! -d $DIR ];then mkdir -p $DIR echo -e "\033[32m目录创建成功!\033[0m" else echo -e "\033[32m目录已存在!\033[0m" fi
#!/bin/bash FILES=/tmp/test.txt if [ ! -f $FILES ];then echo "ok" >> $FILES echo "文件创建成功!" else echo -e "\033[32m---------------------\033[0m" echo "文件已存在,内容如下!" cat $FILES fi
#!/bin/bash scores=$1 if [ -z $scores ];then echo "usage:{$0 60|80}" exit fi if [[ $scores -gt 85 ]];then echo "very good!"; elif [[ $scores -gt 75 ]];then echo "good!"; elif [[ $scores -gt 60 ]];then echo "pass!"; else echo "考试不及格,补考!" fi ———————————————— 版权声明:本文为CSDN博主「TG_天道」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u013915081/article/details/106661313