当前位置: 技术问答>linux和unix
第一个有问题的shell程序
来源: 互联网 发布时间:2016-03-09
本文导语: if test $#=3 then case $2 in +) let z=$1+$3;; -) let z=$1-$3;; *) let z=$1*$3;; /) let z=$1/$3;; *) echo "$2 invalied operator" exit;; esac echo "An...
if test $#=3
then
case $2 in
+) let z=$1+$3;;
-) let z=$1-$3;;
*) let z=$1*$3;;
/) let z=$1/$3;;
*) echo "$2 invalied operator"
exit;;
esac
echo "Answer is $z"
else
echo "Usage : -$0 valuel operator values2"
fi
then
case $2 in
+) let z=$1+$3;;
-) let z=$1-$3;;
*) let z=$1*$3;;
/) let z=$1/$3;;
*) echo "$2 invalied operator"
exit;;
esac
echo "Answer is $z"
else
echo "Usage : -$0 valuel operator values2"
fi
|
两个星号,呵呵