输入学生成绩判断等级
#!/bin/bash
read score
case $score in
9[0-9]|100)
echo "A"
;;
8[0-9])
echo "B"
;;
7[0-9])
echo "C"
;;
6[0-9])
echo "D"
esac
使用shell中的while打印99乘法表
#!/bin/bash
i=1
j=1
while [ $i -le 9 ]
do
j=1
while [ $j -le $i ]
do
sum=$(($i*$j))
echo -n "$i*$j=$sum "
((j=j+1))
done
echo " "
((i=i+1))
done