Linux的shell编程——判断语句

一:if语句
#!/bin/bash
echo "Enter the percentage of calls answer same day."
read score
#如果score小于等于80
if [ $score -le 80 ]
then
       echo "your score is average"
#如果score大于80并且小于90
elif [ $score -gt 80 -a $score -le 90 ]
then
       echo "your score is good"
else
       echo "your score is outstanding"
fi
二:case语句
#!/bin/bash
echo " List of Services Offered by Diaz Telecommunications"
echo " 1) Global Roam"
echo " 2) V-mail"
echo " 3) Mall on Move"
echo " 4) Caller-ID"
echo " 5) Dial a Pizza"
echo "Select the service for which you need more information[1-5] : "
read choice
case $choice in
1) echo "Global.";;
2) echo "V-mail.";;
3) echo "Mall.";;
4) echo "Caller.";;
5) echo "Dial.";;
*) echo "valid option.";;
esac
注意:if fi 和 case esac 这种搭配
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值