exit

Official Description

Causes the shell to exit with the exit status specified by n.

Syntax

exit [n]

Options

None

Oddities

If n is omitted, the exit status is that of the last command executed.

The $? variable is changed after each command, including null commands (carriage returns).

Example

$ print $$                   # Current pid
3972
$
$ ksh                        # Make child process
$
$ print $$                   # Child pid
4128
$
$ exit 5                     # Exit from child with failing status
$ print $?
5                            # Display status
$
				

Get Korn Shell Programming by Example 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.