`exit` man page

terminal

MacOS 14, M3 Pro, default zsh shell

I am trying to find the man page for exit corresponding to this entry on SS64. Using man -a exit loads builtin(1) twice, exit(3) once, and Tcl built-in command exit(n) twice.

Can I access the entry on SS64 linked above locally through Terminal? whatis exit is hard to parse, but I couldn't find anything relevant there.

Best Answer

exit is usually provided by your shell, it is not a separate binary.

You will note that there is no exit binary in either of /bin or /usr/bin, and that the man page for exit pulls up builtin(1), which refers you to the man page for your shell.

For example, I use ksh, this is from the ksh man page:

exit [ n ]
              Causes the shell to exit with the exit status specified by n.  The value will be the least significant 8
              bits of n (if specified) or of the exit status of the last command executed.  An end-of-file will also
              cause the shell to exit, except for an interactive shell that has the ignoreeof option turned on (see
              set below).

The exit builtin in ksh also has its own man page (most builtins in ksh have integrated man pages):

NAME
  exit - exit the current shell

SYNOPSIS
  exit [ options ] [n]

DESCRIPTION
  exit is a shell special built-in that causes the shell that invokes it to exit. Before exiting the shell, if the EXIT
  trap is set it will be invoked.

  If n is given, it will be used to set the exit status.

EXIT STATUS
  The exit status is the least significant eight bits of the value of n (if specified) or of the exit status of the
  preceding command. If exit is invoked inside a trap, the preceding command means the command that invoked the trap.

SEE ALSO
  break(1), return(1)

IMPLEMENTATION
  version         exit (ksh 93u+m) 2021-12-08

You can display the integrated man pages forksh builtins with the --man argument.