Linux-shell之判断大小
# cat test21.sh#!/bin/bash
cat /dev/null
RE_B=$?
if [ $RE_A -ne 0 -o $RE_B -ne 0 ]
then
echo "one of you input is not int"
exit 1
fi
if [ $a -eq $b ];
then
echo "$a = $b"
elif [ $a -gt $b ]
then
echo "$a > $b"
else
echo "$a < $b"
fi
# sh test2
test20.shtest21.shtest2.sh
# sh test21.sh
1-10... zhengshu
panduan daxiao:e e
one of you input is not int
# sh test21.sh
1-10... zhengshu
panduan daxiao:2 34
2 < 34
# sh test21.sh
1-10... zhengshu
panduan daxiao:3 3
3 = 3
#
页:
[1]