#!/bin/bash
#
a=$1
b=$2
USAGE() {
echo "Usage `basename $0 ` num1 num2"
exit
}
if [ $# -ne 2 ];then
USAGE
fi
expr $a + 0 &>/dev/null //判断输入的a是不是整数
[ $? -ne 0 ]&& USAGE
echo "$a-$b"=$(($a-$b))
echo "$a*$b"=$(($a*$b))
echo "$a/$b"=$(($a/$b))
echo "$a%$b"=$(($a%$b))
echo "$a**$b"=$(($a**$b))
#
a=$1
b=$2
USAGE() {
echo "Usage `basename $0 ` num1 num2"
exit
}
if [ $# -ne 2 ];then
USAGE
fi
expr $a + 0 &>/dev/null //判断输入的a是不是整数
[ $? -ne 0 ]&& USAGE
expr $b + 0 &>/dev/null //判断输入的b是不是整数
[ $? -ne 0 ]&& USAGE
echo "$a+$b"=$(($a+$b))echo "$a-$b"=$(($a-$b))
echo "$a*$b"=$(($a*$b))
echo "$a/$b"=$(($a/$b))
echo "$a%$b"=$(($a%$b))
echo "$a**$b"=$(($a**$b))