标签:输入 read span echo 算术运算 个数 div 数字 amp
#!/bin/bash echo "请输入第一个数" read a echo "请输入第二个输" read b if [[ ${b} != *[!0]* ]] && [[ ${a} != *[!0123456789]* ]]; then echo "除数为0!!!!!!!!!!!!!!!!!" echo "和为"`echo $(( ${a} + ${b} ))` echo "差为"`echo $(( ${a} - ${b} ))` echo "积为"`echo $(( ${a} * ${b}))` elif [[ ${a} != *[!0123456789]* ]] && [[ ${b} != *[!0123456789]* ]]; then echo "和为"`echo $(( ${a} + ${b} ))` echo "差为"`echo $(( ${a} - ${b} ))` echo "商为"`echo $(( ${a} / ${b} ))` echo "积为"`echo $(( ${a} * ${b}))` echo "余数为"`echo $(( ${a} % ${b}))` else echo "输入错误" fi
标签:输入 read span echo 算术运算 个数 div 数字 amp
原文地址:http://www.cnblogs.com/zhangzhongming/p/6121136.html