输入两个数,实现两个数的排序
#!/bin/bash
arr=()
read -p "请输入两个数字" -a arr
if ((arr[0]>arr[1]))
then
a=${arr[0]}
arr[0]=${arr[1]}
arr[1]=$a
fi
echo ${arr[*]}
输入一个数,计算是否是水仙花
#!/bin/bash
read a
if ((a<999&&a>100))
then
g=a%10
s=a/10%10
b=a/100
if ((g**3+s**3+b**3==a))
then
echo YES
else
echo NO
fi
fi
输入一个成绩实现登记判断
90-100A
80-89B
70-79C
60-69D
0-59E
#!/bin/bash
read a
if ((a>=90&&a<=100))
then
echo A
elif ((a>=80&&a<=89))
then
echo B
elif ((a>=70&&a<=79))
then
echo C
elif ((a>=60&&a<=69))
then
echo D
elif ((a>=0&&a<=59))
then
echo E
fi