Exit Status (GNU Grep 3.7)
From Get docs
Grep/docs/latest/Exit-Status
Next: grep
Programs, Previous: Environment Variables, Up: Invoking grep
[Contents][Index]
2.3 Exit Status
Normally the exit status is 0 if a line is selected, 1 if no lines were selected, and 2 if an error occurred. However, if the -q
or --quiet
or --silent
option is used and a line is selected, the exit status is 0 even if an error occurred. Other grep
implementations may exit with status greater than 2 on error.