Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the error exit values for diff?

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?

like image 247
sid_com Avatar asked Aug 07 '11 07:08

sid_com


People also ask

What do different exit codes mean?

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.

What does exited with code 1 mean?

The "Exit Code 1" is simply a "Generic Exit Code" which means the job failed and this can be for any reason.

What is exit code 255 Linux?

Depending on our shell, exit code 255 might mean that the returned exit code is outside of the 0-255 range.


1 Answers

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, and 2 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.

like image 58
Frédéric Hamidi Avatar answered Sep 19 '22 10:09

Frédéric Hamidi