#!/bin/bashread -t 30 -p "shu ru shu zi:" num1read -t 30 -p "shu ru shu zi:" num2read -t 30 -p "shu ru fu hao:" opeif [ -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/bashread -t 30 -p "shu ru shu zi:" num1read -t 30 -p "shu ru shu zi:" num2read -t 30 -p "shu ru fu hao:" opeif [ -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"
- 2 回答
- 0 关注
- 1838 浏览
添加回答
举报
0/150
提交
取消