1163

6 分钟

#Bash 的 continue 命令

continue [N]

功能

结束本轮循环,继续下一轮循环。

类型

Bash 内置命令。

参数

  • N - 继续第 N 层循环的下一轮;默认为 1

#示例

for ((x=0; x<10; x=x+1)); do for ((y=0; y<10; y=y+1)); do for ((z=0; z<10; z=z+1)); do echo $x $y $z continue 3 # 继续第 3 层循环的下一轮 done done done

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

#相关命令

命令说明
break跳出循环

#推荐阅读

#手册

continue: continue [n] Resume for, while, or until loops. Resumes the next iteration of the enclosing FOR, WHILE or UNTIL loop. If N is specified, resumes the Nth enclosing loop. Exit Status: The exit status is 0 unless N is not greater than or equal to 1.

创建于 2025/11/7

更新于 2025/11/7