1.输入两个数,实现两个数的排序
#!/bin/bash
read -p "Please input two number:" a
if ((a>b))
then
t=$a
a=$b
b=$t
fi
echo "sort from small to large:$a $b"
2.输入一个数,计算是否是水仙花
#!/bin/bash
read -p "Please input a number:" num
if ((num>=100&&num<=999&&num==(num%10)**3+(num/10%10)**3+(num/100)**3))
then
echo "YES"
else
echo "NO"
fi
3.输入一个成绩实现登记判断
90-100A
80-89B
70-79C
60-69D
0-59E
#!/bin/bash
read -p "Please input a score:" score
t=$((score/10))
if ((t==10 || t==9))
then
echo "A"
elif ((t==8))
then
echo "B"
elif ((t==7))
then
echo "C"
elif ((t==6))
then
echo "D"
elif ((t>=0 && t<=5))
then
echo "E"
else
echo "score illegal"
fi