码迷,mamicode.com
首页 > 系统相关 > 详细

shell 分支/循环

时间:2017-01-14 23:17:16      阅读:309      评论:0      收藏:0      [点我收藏+]

标签:;;   read   $#   cas   nbsp   blog   director   odi   date   

if((i%2==1)); then
    patern="Update"
else
    patern="Read"
fi
case $1 in
"-h")
    if [ $# -lt 2 ]
        then
            helpInfo
    else
        errorUse $@
    fi
    ;;
"-d")
    if [ $# -lt 2 ]
        then
            noDirectory
    elif [ $# -gt 2 ]
        then
            errorUse $@
    else
        DIR=$2
    fi
    ;;
*)
    errorUse $@
    ;;
esac

 

for i in `seq 10`
do
...
done
------------------->$ seq 2
1
2
------------------->$ seq 1 3
1
2
3
------------------->$ seq 1 2 5
1
3
5

 

shell 分支/循环

标签:;;   read   $#   cas   nbsp   blog   director   odi   date   

原文地址:http://www.cnblogs.com/drizzlewithwind/p/6278709.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!