我有下面的代码,并收到以下错误输出:
Enter your exam score
40
./if2.sh: line 6: 40: No such file or directory
Very well done. You have an A grade.
我在 CentOS 上使用 bash 4.1.2(1)。
#!/bin/bash
#This script demonstrates the if-then-elif format.
echo "Enter your exam score"
read exam_pct
if [ $exam_pct < 40 ]
then
echo "Sorry, you have failed."
elif [ $exam_pct > 70 ]
then
echo "Very well done. You have an A grade."
else
echo "Well done. You passed."
fi
这里有什么问题?