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
https://stackoverflow.com/questions/419163/what-does-if-name-main-do