#!/bin/bash
while [ "0" == "0" ]
do
read -p "please in put the number1 :" num1
read -p "please in put the number2 : " num2
read -p "please in put your wants : " flag
if [ "$num1" == "0" ] && [ "$num2" == "0" ];then
break
fi
case $flag in
"+")
echo $(($num1+$num2))
;;
"-")
echo $(($num1-$num2))
;;
"*")
echo $(($num1*$num2))
;;
"/")
echo $(($num1/$num2))
;;
"%")
echo $(($num1%$num2))
;;
esac
read -p "do you want to continue : " yn
if [ "$yn" == "N" ] || [ "$yn" == "n" ];then
break
fi
done
exit 0
LInux Shell编程初探
最新推荐文章于 2024-07-02 21:06:56 发布