脚本内容如下:
#!/bin/bash
error=0
while true
do
one="请输入第一个数字 : "
two="请输入第二个数字 : "
san="请输入(+|-|*|/) : "
bb="--------------------"
t="输入q或Q退出这个计算器"
read -p "$one" num1
if [[ "$num1" == q || "$num1" == Q ]]
then
exit
fi
if [ -n "$num1" ]
then
num11=`echo "$num1" | sed 's/[0-9]//g'`
if [ -z "$num11" ]
then
error=0
read -p "$two" num2
if [[ "$num2" == q || "$num2" == Q ]]
then
exit
fi
if [ -n "$num2" ]
then
error=0
num22=`echo "$num2" | sed 's/[0-9]//g'`
if [ -z "$num22" ]