您的位置:首页 > 运维架构 > Shell

shell 中的 if-elif-else 语句使用实例

2011-12-13 13:00 1161 查看
#!/bin/sh
#shellThird.sh
# to show the method of if
echo -n "Enter the first integer:"
read First
echo -n "Enter the second integer:"
read Second
if [ "$First" -gt "$Second" ]
then
echo "$First is greater than $Second"
elif [ "$Second" -gt "$First" ]
then
echo "$Second is greater than $First"
else
echo "$First is equal to $Second"
fi
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: