首页 > 系统服务 > 详细

Linux学习记录(二)----if

时间:2015-10-22 18:52:44      阅读:249      评论:0      收藏:0      [点我收藏+]

常用格式

格式一:

if 条件; then

    语句

fi

格式二:

if 条件; then

    语句

else

    语句

fi

格式三:

if 条件; then

    语句

elif 条件; then

    语句

fi

格式四:

if 条件; then

    语句

elif 条件; then

    语句

else

    语句

fi

使用示例

(1)判断字符串相等

if [ "foo" = "foo" ]; then
   echo expression evaluated as true
else
    echo expression evaluated as false
 fi

result  : expression evaluated as true

(2)

---------------------初次乍到,待补充------

Linux学习记录(二)----if

原文:http://www.cnblogs.com/xinqi/p/4901687.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!