bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exit statuses and errors messages (was Re: grep . /; echo $?)


From: Julian Foad
Subject: Re: Exit statuses and errors messages (was Re: grep . /; echo $?)
Date: Wed, 09 Nov 2005 12:21:18 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511

Charles Levert wrote:
* On Tuesday 2005-11-08 at 20:40:12 -0500, Charles Levert wrote:

     However, encouraging
     users to use the "test $? -gt 1" (or
     "test $? -ge 2") logic might be a good
     thing to do for portability in any case,
     as this is all that POSIX mandates (for
     grep, cmp, diff, and possibly others).

     Should this be added to the docs?

Yes.  Good idea.  +1 on this patch.

- Julian


[...]
 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
[...]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]