标签:and shel tin style random for i++ bin ash
#!/bin/bash ### for循环,数字段形式 echo ‘for 循环,数字段形式‘ for i in {1..3} do echo $i done ### for 循环,双括号形式 echo ‘for 循环,双括号形式‘ for ((i=1;i<5;i++)) do echo $RANDOM done ### for seq echo ‘for循环,序列形式‘ for i in `seq 6` do if ((i%3==0));then echo " $i%3 is zero" continue fi done # while 循环 双括号形式 echo ‘while循环,双括号形式‘ declare -i min=1 declare -i max=5 while (( $min < $max )) do echo $min #min = `expr $min +1` min=$min+1 done #### while循环,方括号形式 echo ‘while循环,方括号形式‘ min=1 while [ $min -le $max ] do echo $min # 注意等号两边空格以及 加号两边空格,vim下显示 白色+是正确的 min=$min+1 done
标签:and shel tin style random for i++ bin ash
原文地址:http://www.cnblogs.com/cpuz/p/7271557.html