刚学习shell的时候,写了一个娱乐的;想起来写在这里,希望大家不要jianxiao!

 #!/bin/bash

echo "先选择运算的种类 加减乘除,然后分别输入运费的数字就可以得到结果,输入时间为30秒"

 

read -p "Please enter the type of operation + or - or * or / :" -t 30 f

 case "$f" in

  "+")

 read -p "Please enter the number1:" -t 30 numb1

 read -p "Please enter the number2:" -t 30 numb2

 typeset -i numb3="$numb1+$numb2"

echo $numb3

 ;;

 "*")

 read -p "Please enter the number1:" -t 30 numb1

 read -p "Please enter the number2:" -t 30 numb2

 typeset -i numb3="$numb1*$numb2"

echo $numb3

;;

"-")

 read -p "Please enter the number1:" -t 30 numb1

 read -p "Please enter the number2:" -t 30 numb2

 typeset -i numb3="$numb1-$numb2"

 

echo $numb3

;;

"/")

 read -p "Please enter the number1:" -t 30 numb1

 read -p "Please enter the number2:" -t 30 numb2

 typeset -i numb3="$numb1/$numb2"

echo $numb3

;;

*)

echo "error,Please re-run!"

esac