if [ $# -eq 0 ]
then
read op1
read op
read op2
else
op1=$1
op=$2
op2=$3
fi
echo -n $op1
echo -n $op
echo -n $op2
case $op in
+)
ret=`expr $op1 + $op2`
;;
-)
ret=`expr $op1 - $op2`
;;
\*)
ret=`expr $op1 \* $op2`
;;
/)
if [ $op2 -eq 0 ]
then
echo the 0
exit
fi
ret=`expr $op1 / $op2`
;;
*)
echo "Usage: op1 op op2"
exit
;;
esac
echo "=$ret"
阅读(1039) | 评论(0) | 转发(0) |