diff options
author | Charles Levert <charles_levert@gna.org> | 2005-11-09 20:04:40 +0000 |
---|---|---|
committer | Charles Levert <charles_levert@gna.org> | 2005-11-09 20:04:40 +0000 |
commit | fc9d313a16370b5160e2917c9ef122fdc418e7bb (patch) | |
tree | b2eb2181fa1694d135bfe92089cd522c48bc8efb | |
parent | d25bebd35aae9c5ed0e1d62eb211ff16586e759f (diff) | |
download | grep-fc9d313a16370b5160e2917c9ef122fdc418e7bb.tar.gz |
* doc/grep.1, doc/grep.texi: Advise users to test for
"exit_status > 1" instead of "exit_status == 2" in order to
detect errors, for portability with other POSIX-compliant
implementations.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/grep.1 | 11 | ||||
-rw-r--r-- | doc/grep.texi | 6 |
3 files changed, 23 insertions, 1 deletions
@@ -1,5 +1,12 @@ 2005-11-09 Charles Levert <charles_levert@gna.org> + * doc/grep.1, doc/grep.texi: Advise users to test for + "exit_status > 1" instead of "exit_status == 2" in order to + detect errors, for portability with other POSIX-compliant + implementations. + +2005-11-09 Charles Levert <charles_levert@gna.org> + The following set of changes aims to make "egrep" and "fgrep" minimal executable programs for legacy applications, instead of shell scripts. This "fgrep" is much smaller than "grep". @@ -12,7 +12,7 @@ .de Id .ds Dt \\$4 .. -.Id $Id: grep.1,v 1.35 2005/11/08 21:35:33 charles_levert Exp $ +.Id $Id: grep.1,v 1.36 2005/11/09 20:04:41 charles_levert Exp $ .TH GREP 1 \*(Dt "GNU Project" .SH NAME grep, egrep, fgrep \- print lines matching a pattern @@ -832,6 +832,15 @@ or or .B \-\^\-silent option is used and a selected line is found. +Note, however, that \s-1POSIX\s0 only mandates, for programs such as +.BR grep , +.BR cmp , +and +.BR diff , +that the exit status in case of error be greater than 1; +it is therefore advisable, for the sake of portability, +to use logic that tests for this general condition +instead of strict equality with 2. .SH BUGS .PP Email bug reports to diff --git a/doc/grep.texi b/doc/grep.texi index 7ebedf4d..dfdbb02a 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -707,6 +707,12 @@ Normally, exit status is 0 if selected lines are found and 1 otherwise. But the exit status is 2 if an error occurred, unless the @option{-q} or @option{--quiet} or @option{--silent} option is used and a selected line is found. +Note, however, that @sc{posix} only mandates, +for programs such as @command{grep}, @command{cmp}, and @command{diff}, +that the exit status in case of error be greater than 1; +it is therefore advisable, for the sake of portability, +to use logic that tests for this general condition +instead of strict equality with 2. @node grep Programs @chapter @command{grep} programs |