1、使用数组统计用户家目录下文件的个数
#!/bin/bash
arr=(`ls ~`)
echo "家文件下的文件数为:"${#arr[*]}
2. 输入学生成绩,输出成绩等级,[100-90]A,[90-80]B,[80-70]C,[70-60]D,[60-0]E,小于0,大于100输 入不合理
read -p "请输入学生成绩: " i
if test $i -le 100 -a $i -ge 90
then
echo "A"
elif test $i -ge 80 -a $i -lt 90
then
echo "B"
elif test $i -ge 70 -a $i -lt 80
then
echo "C"
elif test $i -ge 60 -a $i -lt 70
then
echo "D"
elif test $i -ge 0 -a $i -lt 60
then
echo "E"
else
echo "不合理"
fi