On the diff
man-page I've found these exit values:
0 No differences were found. 1 Differences were found. >1 An error occurred.
Are there different exit values above 1 for different errors?
The simple explanation for an exit code is that the executable program is programmed to return a whole number that shows whether it was successfully executed. In general, zero is usually the signal for successful execution, and numbers from 1-255 represent various negative outcomes or problems.
The "Exit Code 1" is simply a "Generic Exit Code" which means the job failed and this can be for any reason.
Depending on our shell, exit code 255 might mean that the returned exit code is outside of the 0-255 range.
It depends on your diff
command. Mine (GNU diffutils 3.0) says:
An exit status of
0
means no differences were found,1
means some differences were found, and2
means trouble. Normally, differing binary files count as trouble, but this can be altered by using the-a
or--text
option, or the-q
or--brief
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With