帮忙看看哪错了,一直提示运算符行出错
#!/bin/bash
read -t 30 -p "shu ru shu zi:" num1
read -t 30 -p "shu ru shu zi:" num2
read -t 30 -p "shu ru fu hao:" ope
if [ -n "$num1" -a -n "$num2" -a -n "$ope" ]
then
test1=$( echo $num1 | sed 's/[0-9]//g' )
test2=$( echo $num1 | sed 's/[0-9]//g' )
if [ -z "$test1" -a -z "$test2" ]
then
#!/bin/bash
read -t 30 -p "shu ru shu zi:" num1
read -t 30 -p "shu ru shu zi:" num2
read -t 30 -p "shu ru fu hao:" ope
if [ -n "$num1" -a -n "$num2" -a -n "$ope" ]
then
test1=$( echo $num1 | sed 's/[0-9]//g' )
test2=$( echo $num1 | sed 's/[0-9]//g' )
if [ -z "$test1" -a -z "$test2" ]
then
if [ "$ope" == '+' ]
then
sum=$(($sum1+$sum2))
elif [ "$ope" == '-' ]
then
sum=$(($num1-$num2))
elif [ "$ope" == '*' ]
then
sum=$(( $sum1 * $sum2 ))
elif [ "$ope" == '/' ]
then
sum=$(( $sum1 / $sum2 ))
else
echo "shu ru fu hao"
exit 10
fi
else
echo "shu ru shu zi"
exit 11
fi
else
echo "shu ru zi fu"
fi
echo "$num1$ope$num2 : $sum"
shu ru shu zi:1
shu ru shu zi:1
shu ru fu hao:+
./if5.sh: line 13: +: syntax error: operand expected (error token is "+")
1+1 :