Section one: Breank commands
4 loops for, while, until, select, if you want to end the loop early, you can use the break command in the loop. When you perform a break, you jump out of a layer of loops, and if you want to jump out of a multilayer loop, you can add the number of layers n after the break command (n must be greater than or equal to 1).
#!/bin/bashfor ((i=1;i<=10;i++)) doif [$i-eq 6]; Thenbreakfiecho $idone
Line 5, if the value of I equals 6, jump out of the loop, that is, end the loop .
Section II: Continue commands
The Continue is used in the 4 loop statements for, while, Untile, select. Unlike break, continue will jump out of this loop and start again with the next loop.
Example:
#!/bin/bashfor (i=1;i<=10;i++;)) doif [$i-eq 6]; Thencontinuefiecho $idone
Shell Getting Started Tutorial: Process Control (7) Break and continue