when a shell program calls some program and the program return say value 42, where is this value stored ? Give a detailed description of what happens then ?
Sigiloso
Exit codes are a number between 0 and 256, which is returned by any Unix command when it returns control to its parent process. Other numbers can be used, but these are treated modulo 256, so exit -10 is equivalent to exit 246, and exit 257 is equivalent to exit 1. Value is stored in $?. Then it returns control to the parent process. use has to check this special variable's value and move on accordingly.