Next: , Previous: , Up: Invoking   [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 -L or --files-without-match is used, the exit status is 0 if a file is listed, 1 if no files were listed, and 2 if an error occurred. Also, 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.