break — Exit from a loop in a shell script

Format

break [number]

tcsh shell: break

Description

break exits from a for, select, while, or until loop in a shell script. If number is given, break exits from the given number of enclosing loops. The default value of number is 1.

break is a special built-in shell command.

In the tcsh shell, break causes execution to resume after the end of the nearest enclosing foreach or while. The remaining commands on the current line are executed. Multilevel breaks are thus possible by writing them all on one line.

Localization

break uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

break always exits with an exit status of 0.

Portability

POSIX.2, X/Open Portability Guide.

Related information

continue, sh, tcsh