root@node1 shell]# cat scores.sh
#!/bin/bash
#By author lansefenghuo
read -p "Please input the scores:" scores
if [ $scores -eq 100 ]
then
echo "very good!";
elif [ $scores -gt 85 ]
then
echo "good!";
elif [ $scores -gt 60 ]
then
echo "pass!";
elif [ $scores -lt 60 ]
then
echo "no pass!"
elif [ $scores = 0 ]
then
echo "Oh, My God!"
fi
[root@node1 shell]# sh scores.sh
Please input the scores:85
pass!
[root@node1 shell]# sh scores.sh
Please input the scores:86
good!
[root@node1 shell]# sh scores.sh
Please input the scores:85
pass!
[root@node1 shell]# sh scores.sh
Please input the scores:59
no pass!
[root@node1 shell]#
转载于:https://blog.51cto.com/13497623/2045399