An exit code is an integer that a process returns to its parent process or shell when it finishes running. It is also called an exit status or return code. On Unix-like operating systems, the convention is that 0 means success and any nonzero value means failure or an error, with values ranging from 0 to 255. The meaning of each nonzero value is defined by the individual program.
Shells expose the exit code of the most recent command through a special variable, and conditionals and command-chaining operators use it to decide what runs next. Shell scripts, build tools, test runners, and CI pipelines rely on exit codes to judge whether a step passed or failed. AI coding agents likewise read the exit codes of the commands and automated scripts they run to decide whether to continue or to fix a problem.