#!/bin/bash
read -p "请输入你的分数:" n
if [ -z "$n" ] `` #判断是否为空
thenbash
echo "输入的数值不能为空" exit 1 #为空直接退出脚本
fi
n1=echo $n|sed 's/[0-9]//g'
#把数值替换成null
if [ -n "$n1" ] #若是不为空执行如下语句
thenide
echo "请输入正确的数值(在0-100之间)" exit 1
fiexcel
if (($n>=0))&&(($n<60)) then tag=1 elif [ $n -ge 60 ] && [ $n -lt 80 ] then tag=2 elif [ $n -ge 80 -a $n -lt 90 ] then tag=3 elif (($n>=90)) && [ $n -le 100 ] then tag=4 else echo "输入的数字请在0-100之间" fi case $tag in 1) echo "fail" ;; 2) echo "great" ;; 3) echo "excellent" ;; 4) echo "wonderful" ;; esac