Shell脚本编程——两个数比较大小
代码如下:
#!/bin/bash
# scriptname: ex4if.sh
#
echo -n "Please input x,y:"
read x y
echo "x=$x,y=$y"
if((x>y));then
echo "x is larger than y"
elif((x=y));then
echo "x is equal to y"
else
echo "x is less than y"
fi
代码如下:
#!/bin/bash
# scriptname: ex4if.sh
#
echo -n "Please input x,y:"
read x y
echo "x=$x,y=$y"
if((x>y));then
echo "x is larger than y"
elif((x=y));then
echo "x is equal to y"
else
echo "x is less than y"
fi