首页 > 代码库 > shell 分支/循环

shell 分支/循环

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 分支/循环