#!/bin/bash
read -p "请输入第一个数:" num1
read -p "请输入运算符:" fuhao
read -p "请输入第二个数:" num2
if [ "$fuhao" == "+" ]
then
echo $num1 + $num2=$(($num1+num2))
elif [ "$fuhao" == "-" ]
then
echo $num1 - $num2=$(($num1-num2))
elif [ "$fuhao" == "*" ]
then
echo $num1 * $num2=$(($num1*num2))
else [ "$fuhao" == "/" ]
echo $num1 / $num2=$(($num1/num2))
fi
shell计算器脚本
最新推荐文章于 2023-02-01 08:56:45 发布