标签:style blog color ar for sp div on log
break:用来跳出循环。break N 可以跳出多层循环
break
break N
continue:用来跳过循环。continue N 可以跳过多层循环
continue
continue N
for var1 in 1 2 3 do for var2 in 0 5 do if [ "$var1" -eq "2" -a "$var2" -eq "0" ]; then break 2 else echo "$var1 $var2" fi done done
user@ae01:~$ ./test.sh 1 0 1 5
for var1 in 1 2 3 do for var2 in 0 5 do if [ "$var1" -eq "2" -a "$var2" -eq "0" ]; then continue 2 else echo "$var1 $var2" fi done done
user@ae01:~$ ./test.sh 1 0 1 5 3 0 3 5
Shell 编程基础之 Break, Continue 练习
标签:style blog color ar for sp div on log
原文地址:http://www.cnblogs.com/tannerBG/p/4058762.html