Name

exit

Synopsis

                  exit [n]

Exit a shell script with status n (e.g., exit 1). n can be zero (success) or nonzero (failure). If n is not given, exit status will be that of the most recent command. exit can be issued at the command line to close a window (log out).

Example

                  if [ $# -eq 0 ]; then
                     echo "Usage:  $0 [-c] [-d] file(s)"
                     exit 1     # Error status
                  fi

Get Linux in a Nutshell, Fourth Edition 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.