编写 shell 脚本,实现两个变量之间的加减乘除运算。
今天是5.20,大家跟喜欢的人表白了吗?祝大家都表白顺利,如果是有对象的,那祝你们99!ღ( ´・ᴗ・` )比心
代码:
#!/bin/bash
read -p "input number:" a
read -p "input number:" b
read -p "input fuhao:" c
case $c in
+)let "result=$a+$b"
echo $result;;
-)let "result=$a-$b"
echo $result;;
/)let "result=$a/$b"
echo $result;;
*)let "result=$a*$b"
echo $result;;
esac
运行结果: