Software Engineering :: Operating Systems :: Linux :: Command :: Shell :: Exit Status
⪼ Made with 💜 by Polyglot.
- Software Engineering :: Programming :: Command Line Interface (CLI)
- Software Engineering :: Programming :: Languages :: JavaScript :: Runtimes :: Node.js :: Process :: process.exitCode
The exit status of an executed command is the value returned by the
waitpidsystem call or equivalent function. Exit statuses fall between0and255, though, as explained below, the shell may use values above125specially. Exit statuses from shell builtins and compound commands are also limited to this range. Under certain circumstances, the shell will use special values to indicate specific failure modes.
All of the Bash builtins return an exit status of 0 if they succeed and a non-0 status on failure, so they may be used by the conditional and list constructs.
All builtins return an exit status of 2 to indicate incorrect usage, generally invalid options or missing arguments.
- a command which exits with a
0exit status has succeeded - An exit status
non-0indicates failure - If a command is not found, the child process created to execute it returns a status of
127 - If a command is found but is not executable, the return status is
126. - If a command fails because of an error during expansion or redirection, the exit status is greater than zero.