exit - Return to the shell's parent process or to TSO/E

Format

exit [expression]

tcsh shell: exit [expr]

Description

exit ends the shell. If there is an expression, the value of the expression is the exit status of the shell.

The value of expression should be between 0 and 255. For values outside this range, the exit status will be the least significant 8 bits of the value of the expression. The EXIT trap is raised by the exit command, unless exit is being called from inside an EXIT trap.

If you have a shell background job running, you cannot exit from the shell until it completes. However, you can switch to subcommand mode and exit.

In the tcsh shell, the shell exits either with the value of the specified expression or, without expression, with the value of the status variable. The value of expression should be between 0 and 255. See tcsh - Invoke a C shell.

Usage notes

exit is a special built-in shell command.

Localization

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

Exit values

exit returns the value of the arithmetic expression specified by the expression argument to the parent process as the exit status of the shell. If you omit expression, exit returns the exit status of the last command run.

Related information

return, sh, tcsh

The exit() ANSI C function, the _exit callable service, and the _exit() POSIX C function are unrelated to the exit shell command.