operators usages
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了operators usages相关的知识,希望对你有一定的参考价值。
#! /bin/bashif [ $# -ne 2 ];then
echo "please input two arguments:"
exit 2
fi
expr $1 + 2 &>/dev/null
if [ $? -ne 0 ];then
echo "please input int."
exit 3
fi
expr $2 + 3 &>/dev/null
if [ $? -ne 0 ];then
echo "please input int."
exit 4
fi
echo "$1+$2 is $(($1+$2))"
echo "$1$2 is $(($1$2))"
echo "$1-$2 is $(($1-$2))"
echo "$1/$2 is $(($1/$2))"
以上是关于operators usages的主要内容,如果未能解决你的问题,请参考以下文章