break, continue — Shell Built-in Functions to Break Out of Loops

Synopsis

sh
break [n] 
continue [n] 
csh
break 
continue 
ksh
* 
break [n] 
* 
continue [n] 

Description

Bourne Shell

break exits from the enclosing for or while loop, if any. If you specify n , break n levels.

continue resumes the next iteration of the enclosing for or while loop. If you specify n , resume at the n -th enclosing loop.

C Shell

break resumes execution after the end of the nearest enclosing foreach or while loop. The remaining commands on the current line are executed. You can write multilevel breaks as a list of break commands, all on one line.

continue continues execution of the next iteration of the nearest enclosing while or foreach loop.

Korn Shell

break ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.