break跳出循环
-
#!/bin/bash for i in `seq 1 5` do echo $i if [ $i == 3 ] then break fi echo $i done echo aaaaaaa
continue结束本次循环
-
忽略continue之下的代码,直接进行下一次循环 #!/bin/bash for i in `seq 1 5` do echo $i if [ $i == 3 ] then continue fi echo $i done echo $i
exit直接退出脚本
-
#!/bin/bash for i in `seq 1 5` do echo $i if [ $i == 3 ] then exit fi echo $i done echo aaaaaaa