In the grep manual page, under "EXIT STATUS", it says that if there is an
error, grep will exit with a value greater than 1. This turns out to not be
the case in the event of a "No such file or directory" error. In that case,
grep will still return a 0 or 1, depending on if the given search string was
found in any of the other arguments.

Other implementations of grep, such as GNU's and the version in Mac OS X will
do the full search of all arguments and generate the expected output, but if
any file is unable to be opened, they will exit with code 2. I have attached a
small patch to OpenBSD's grep to match this behavior. The patch is written
against the 5.2 RELEASE sources.

Thanks!

        --Jeramey

[demime 1.01d removed an attachment of type application/octet-stream which had 
a name of grep-error.patch]

Reply via email to