On most operating systems, the return value becomes the value returned from the process when it exits. By convention, a return value of zero signifies a normal exit, while non-zero values signify different abnormal termination conditions.
This value can be tested by most command shells. For instance, in bash, the $?
variable holds the return code of the last program. Also, its &&
and ||
operators determine whether to execute the right hand side, based on whether the left hand side signal a normal exit or not:
# Fetch the images, and only process them if the fetch succeeded (return code 0).
fetch-images && process-images