nonzero exit status indicates failure. This seemingly counter-intuitive scheme is used so there is one well-defined way to indicate success and a variety of ways to indicate various failure modes. When a command is terminated by a signal whose number is N, a shell sets the variable $? to a value greater than 128. Most shells use 128+N, while ksh93 uses 256+N. If a command is not found, the shell should return a status of 127. If a command is found but is not executable, the return status should be 126. Note that this is not the case for all shells. If a command fails because of an error during expansion or redirection, the exit status is greater than zero. C language The C programming language allows programs exiting or returning from the main function to signal success or failure by returning an integer, or returning the macros EXIT_SUCCESS and EXIT_FAILURE. On Unix-like systems these are equal to 0 and 1 respectively. A C program may also use the exit() function specifying the integer status or exit macro as the first parameter. The return value from main is passed to the exit function, which for values zero, EXIT_SUCCESS or EXIT_FAILURE may translate it to “an implementation defined form” of successful termination or unsuccessful termination. Apart from zero and the macros EXIT_SUCCESS and EXIT_FAILURE, the C standard does not define the meaning of return codes. Rules for the use of return codes vary on different platforms (see the platform-specific sections). DOS In DOS terminology, an errorlevel is an integer exit code returned by an executable program or subroutine. Errorlevels typically range from 0 to 255. In DOS there are only 256 error codes available, but DR DOS 6.0 and higher support 16-bit error codes at least in CONFIG.SYS. With 4DOS and DR-DOS COMMAND.COM, exit codes (in batchjobs) can be set by EXIT n and (in CONFIG.SYS) through ERROR=n. Exit statuses are often captured by batch programs through IF ERRORLEVEL commands. Multiuser DOS supports a reserved environment variable %ERRORLVL% which gets automatically updated on return from applications. COMMAND.COM under DR-DOS 7.02 and higher supports a similar pseudo-environment variable %ERRORLVL% as well as %ERRORLEVEL%. In CONFIG.SYS, DR DOS 6.0 and higher supports ONERROR to test the load status and return code of device drivers and the exit code of programs. Java In Java, any method can call System.exit(int status), unless a security manager