2009-05-27 21:20:11〃翼╭★

......

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
until [ "$n" == "MUL" -o "$n" == "mul" -o "$n" == "del" -o "$n" == "DEL" -o "$n" == "mod" -o "$n" == "MOD" ]
do
    read -p "please keyin method (ADD/add/DEL/del/MOD/mod) : " n
done
read -p "first number: " q
read -p "second number: " w
y=$n

if [ "$y" == "del" ] || [ "$y" == "DEL" ]; then
    th1=del
elif [ "$y" == "mod" ] || [ "$y" == "MOD" ]; then
    th1=mod
elif [ "$y" == "MUL" ] || [ "$y" == "mul" ]; then
    th1=mul
fi
 
case $th1 in
 del )
    until [ "$w" -lt "$q" ]
    do
        echo "Sorry~first number < second number!"
        read -p "first number: " q
        read -p "second number: " w
    done
    echo "OK!"
    th2=$(($q/$w))
    echo -e "nThe result of $firsnu / $secnu is ==> $th2"
    ;;
 mod )
    th2=$(($q%$w))
    echo -e "nThe result of $firsnu % $secnu is ==> $th2"
    ;;
 mul )
    th2=$(($q*$w))
    echo -e "nThe result of $firsnu * $secnu is ==> $th2"
    ;;
esac