builtin
Bash exit builtin
Ends current shell with n or the previous status if omitted. Practice in a child shell. Status is limited to 0–255.
Formal Syntax & Structure
bash syntaxbash
exit [n]Return Value
exit status
Ends current shell with n or the previous status if omitted. Practice in a child shell. Status is limited to 0–255.
Working Example
Example Snippetbash
bash -c 'exit 9'printf '%s\n' "$?"