I need to talk a little with Johannes answer. True 0 is used for success because there is only 1 successful result, while there can be many unsuccessful results. But my experience is that return codes have less to do with failure reasons than failure levels.
In the days of batch programming, there usually were conventions for return codes that allowed some automation of the overall flow of execution. Thus, return code 4 may be a warning, but the next work may continue; 8 may mean that the work flow should stop; 12 may mean something catastrophic and the fire department should be notified.
Similarly, batches will allocate some range of return codes so that the overall packet stream can branch out. If, for example, the updater returned XX, the package may skip the backup step because nothing has changed.
Return codes as the causes of the failure are not all that useful, of course, not as many as log files, kernel dumps, console alerts, and much more. I have never seen a system that returns XX, because "such and such a file was not found", for example.
source share