#!/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
时间: 2024-11-05 23:35:25