shell--练习--简易计算器

#!/bin/bash

echo "请输入第一个数:"
read fir
echo "请输入运算符:"
echo "1:+"
echo "2:-"
echo "3:*"
echo "4:\/"
read fu
echo "请输入第二个数:"
read se
if [ $fu == 1 ]
then
  echo `expr $fir + $se`
fi
if [ $fu == 2 ]
then
  echo `expr $fir - $se`
fi
if [ $fu == 3 ]
then
  echo `expr $fir \* $se`
fi
if [ $fu == 4 ]
then
  echo `expr $fir / $se`
fi


posted @ 2020-11-10 21:02  HK牛牛  阅读(158)  评论(0编辑  收藏  举报