标签:lease pass core scores bin bash exit mkdir var
一、判断目录是否存在:
#!/bin/bash
#/bin/bash -n filename.sh 判断语句是否正确
DIR=/root/zhj
if [ ! -d $DIR ];then
mkdir $DIR
echo "$DIR create suecces"
else
echo "$DIR is exist,please exst"
fi
#--------------------------------------------
二、多条件语句
#!/bin/bash
scores=$1
if [ -z $scores ];then
echo "please scores "
exit
fi
if [[ $scores -gt 90 ]];then
echo "vare good"
elif [[ $scores -gt 80 ]];then
echo "good"
elif [[ $scores -gt 60 ]];then
echo "pass"
else
echo "no pass"
fi
#---------------------------------------------
标签:lease pass core scores bin bash exit mkdir var
原文地址:http://www.cnblogs.com/zhj5551/p/7618243.html