#!/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"
慕粉1720382552
c5