标签:
#!/bin/bash
#auther:acf
#!/bin/bash
a=$1
b=$2
sum(){
# echo $(($1 + $2))
read -p "first num " num1
read -p "second num " num2
let c=$num1+$num2
}
cf(){
read -p "first num " num1
read -p "second num " num2
let d=$num1*$num2
# let c=$1*$2
# echo $c
#echo cf result $(($1*$2))
}
menu(){
clear
echo -e "1\tsum"
echo -e "2\tcf"
echo -e "3\texit"
echo -e "please key in your choose"
read option
}
main(){
while true
do
menu
case $option in
1)
sum
echo "your first num + second num is $c"
echo "if you want return menu,please input 0 or input another num to out!"
read f
if [ $f == 0 ];then
clear
continue
else break
fi;;
2)
cf
echo "your first num * second num is $d"
echo "if you want return menu,please input 0 or input another num to out!"
read f
if [ $f == 0 ];then
clear
continue
else break
fi;;
3)
break;;
*)
clear
echo "sorry,wrong selection"
;;
esac
done
}
main
标签:
原文地址:http://www.cnblogs.com/blog-acf/p/4265684.html