LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

exit

shell builtin that terminates the current shell or script

TLDR

Exit shell with success status
$ exit
copy
Exit with specific status code
$ exit [1]
copy
Exit on error in scripts
$ set -e; exit
copy

SYNOPSIS

exit [status]

DESCRIPTION

exit is a shell builtin that terminates the current shell or script. An optional exit status is passed to the parent process; 0 conventionally indicates success.In scripts, exit immediately stops execution. In interactive shells, it closes the session. The exit status is available to the parent process via $? in shell scripts.Exit codes have conventional meanings: 0 for success, 1 for general errors, 2 for misuse, 126-127 for execution issues.

PARAMETERS

STATUS

Exit status code (0-255). 0 indicates success.

INSTALL

sudo apk add execline
copy
brew install execline
copy
nix profile install nixpkgs#execline
copy

CAVEATS

Non-zero exits may trigger set -e termination. Status limited to 0-255. Subshells have separate exit. Traps may run before actual exit.

HISTORY

exit is a fundamental POSIX shell builtin, present since the original Bourne shell. Its semantics are consistent across all Unix shells.

SEE ALSO

bash(1), trap(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid