首页 > 其他 > 详细

if与case

时间:2018-01-26 10:51:08      阅读:242      评论:0      收藏:0      [点我收藏+]
#!/bin/bash
if [ $1 -lt 3 ];then
echo redhat
elif [ $1 -eq 3 ];then
echo green
elif [ $1 -gt 3 -a $1 -lt 5 ];then
echo yellow
else
echo white
fi


case $1 in
        1|one|first)echo redhat;;
        2)echo yellow;;
        3)echo green;;
        *)echo blue;;
esac

if与case

原文:http://blog.51cto.com/13560258/2065298

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