From unknown Tue Jun 24 05:13:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18651: Clarify exit status description Resent-From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 07 Oct 2014 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18651 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 18651@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141267460811882 (code B ref -1); Tue, 07 Oct 2014 09:37:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Oct 2014 09:36:48 +0000 Received: from localhost ([127.0.0.1]:36185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbRCK-00035Z-3q for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35705) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbRCI-00035P-1t for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbRCC-00075G-9r for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_50,UNPARSEABLE_RELAY, URIBL_RHS_DOB autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRCC-00075C-7T for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRC7-0002VI-0Y for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbRC2-00073k-2S for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:34 -0400 Received: from mx1.riseup.net ([198.252.153.129]:52116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRC1-00072A-QG for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:30 -0400 Received: from berryeater.riseup.net (berryeater-pn.riseup.net [10.0.1.120]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Gandi Standard SSL CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id D3018494CC for ; Tue, 7 Oct 2014 02:36:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id 3D16C435B1 Received: by nomada (sSMTP sendmail emulation); Tue, 07 Oct 2014 11:36:18 +0200 Date: Tue, 7 Oct 2014 11:36:18 +0200 From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Message-ID: <20141007093618.GA15806@nomada> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XOIedfhf+7KOe/yw" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Scanned: clamav-milter 0.98.4 at mx1 X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.7 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.7 (----) --XOIedfhf+7KOe/yw Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Disposition: inline --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I'm attaching to this mail an old proposal to clarify the exit status description, included in the debian package: https://bugs.debian.org/446854 Regards, Santiago --huq684BweRXVnRxX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="grep-man-exit-status-1.patch" Content-Transfer-Encoding: quoted-printable =46rom 2432287712e802ce821e3158fb4f40a1a7b8b436 Mon Sep 17 00:00:00 2001 =46rom: =3D?UTF-8?q?Santiago=3D20Ruano=3D20Rinc=3DC3=3DB3n?=3D Date: Tue, 7 Oct 2014 11:19:56 +0200 Subject: [PATCH] Simplify EXIT STATUS information * doc/grep.in.1, doc/grep.texi: clarify information regarding exit status. "A. Costa" wrote the original patch. See: https://bugs.debian.org/446854 --- doc/grep.in.1 | 16 ++++------------ doc/grep.texi | 14 ++++---------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 00d030a..44da7e9 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -1143,23 +1143,15 @@ when is not set. . .SH "EXIT STATUS" -Normally, the exit status is 0 if selected lines are found and 1 otherwise. -But the exit status is 2 if an error occurred, unless the +The exit status is 0 if selected lines are found, and 1 if not found. +If an error occurred (and .B \-q or .B \-\^\-quiet 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. +are not used) the exit status is 2. (Note: POSIX error +handling code should check for '2' or greater.) . .SH COPYRIGHT Copyright 1998-2000, 2002, 2005-2014 Free Software Foundation, Inc. diff --git a/doc/grep.texi b/doc/grep.texi index d7adcad..46361ce 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -1025,16 +1025,10 @@ and only when @env{POSIXLY_CORRECT} is not set. @cindex exit status @cindex return status =20 -Normally, the 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 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. +The exit status is 0 if selected lines are found, and 1 if not found. If +an error occurred (and @option{-q} or @option{--quiet} or +@option{--silent} are not used) the exit status is 2. (Note: POSIX error +handling code should check for '2' or greater. =20 =20 @node grep Programs --=20 2.1.0 --huq684BweRXVnRxX-- --XOIedfhf+7KOe/yw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUM7QRAAoJELPyXWsAqAZiT1gP/18OZOKYd1y62f0f1g9BUTCo lR+j2PujPIU1TMdsYlWGvc/Nl5cWnZatkNlIzGuCo+1lStrO/7T9oNsgNk4XXWx5 Gzpxy5ENMGGjlHDT6CN5THZuid2WyshFmPuz4pVNAOu4j9STcW6/qQeFbmre6+66 8BcPO8qo+12HOGustE6OwcfIA40sFpUuHNWVNr9R44ZUmyqWlBAzc8qWpVMkQs41 Tt8Ypvp6aaKUTxEp9pVlvla+um4Z1QvrBEt3h+rrDa+NRjN/6XHtQM7egN9DPmDu n0+ktGCzRZepuFACP4t5pbSy3KwFSzAq0TRrHo0tMX9eHJNcsPYY7L1Ll9LfeNVw 3Zh57VvunVwUuBQqEvSoY1HbNEJRa1H0EGD+zxe5HGZmxl4fYSSgXOCVod4QO9od dJsncKF+zye+UV9bbfJtjHA6KnuPtmCErxKnx36P4IAK6ZGvGMPGKvkKYO5NCPuB ezL0ZNfTk9fmdC8SQEhhH2/IPPV1TYj/9+/YCBRfKC9mG1m+jjd/WjuS05OW956o WDp5XjCng25TjYDTAIPdx4bvRCITjn5kRV+3KYf58CejMzkiYlzi99/qjm+UPnEB Amq3WP6v7wDphQYWFQ3z5Ysw37v5lvjKNFC05aUsPuTSSFEhUGHgRGyrwEXJ4vyt zH+dFjC/OFKCdAZ2j2Ao =KoWe -----END PGP SIGNATURE----- --XOIedfhf+7KOe/yw-- From unknown Tue Jun 24 05:13:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18651: Clarify exit status description Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 07 Oct 2014 16:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18651 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= , 18651@debbugs.gnu.org Received: via spool by 18651-submit@debbugs.gnu.org id=B18651.141269923423104 (code B ref 18651); Tue, 07 Oct 2014 16:28:01 +0000 Received: (at 18651) by debbugs.gnu.org; 7 Oct 2014 16:27:14 +0000 Received: from localhost ([127.0.0.1]:36842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbXbV-00060Z-6s for submit@debbugs.gnu.org; Tue, 07 Oct 2014 12:27:14 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:59798) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbXbR-00060O-Om for 18651@debbugs.gnu.org; Tue, 07 Oct 2014 12:27:11 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1673B39E8013; Tue, 7 Oct 2014 09:27:07 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z3djgibpJgsG; Tue, 7 Oct 2014 09:27:02 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 8393139E8011; Tue, 7 Oct 2014 09:27:02 -0700 (PDT) Message-ID: <54341456.5030904@cs.ucla.edu> Date: Tue, 07 Oct 2014 09:27:02 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 References: <20141007093618.GA15806@nomada> In-Reply-To: <20141007093618.GA15806@nomada> Content-Type: multipart/mixed; boundary="------------010203040501070006040509" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------010203040501070006040509 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hmmm, well, to me the proposed clarification is not that clear either. And the man page is no place for a chatty discussion about what POSIX allows of other implementations; the full manual is the place for that sort of thing. So, how about the attached patches instead? I've pushed them. --------------010203040501070006040509 Content-Type: text/x-patch; name="0001-doc-clarify-exit-status.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-doc-clarify-exit-status.patch" >From 69fa2ecde962b3469effccfa630ad346fcad367d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 7 Oct 2014 08:23:21 -0700 Subject: [PATCH 1/2] doc: clarify exit status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Santiago Ruano Rincón in: http://bugs.gnu.org/18651 * doc/grep.in.1 (EXIT STATUS): * doc/grep.texi (Exit Status): Clarify. --- doc/grep.in.1 | 16 ++++------------ doc/grep.texi | 17 ++++++----------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 00d030a..16b94b2 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -1143,23 +1143,15 @@ when is not set. . .SH "EXIT STATUS" -Normally, the exit status is 0 if selected lines are found and 1 otherwise. -But the exit status is 2 if an error occurred, unless the +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 .B \-q or .B \-\^\-quiet 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. +is used and a line is selected, the exit status is 0 even if an error +occurred. . .SH COPYRIGHT Copyright 1998-2000, 2002, 2005-2014 Free Software Foundation, Inc. diff --git a/doc/grep.texi b/doc/grep.texi index d7adcad..da9a1be 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -1025,17 +1025,12 @@ and only when @env{POSIXLY_CORRECT} is not set. @cindex exit status @cindex return status -Normally, the 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 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. - +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 +@option{-q} or @option{--quiet} or @option{--silent} option is used +and a line is selected, the exit status is 0 even if an error +occurred. Other @command{grep} implementations may exit with status +greater than 2 on error. @node grep Programs @section @command{grep} Programs -- 1.9.3 --------------010203040501070006040509 Content-Type: text/x-patch; name="0002-doc-modernize-and-simplify-man-page.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-doc-modernize-and-simplify-man-page.patch" >From 136b65844472b0ec250ff407b6c6c6b6b16cd658 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 7 Oct 2014 09:22:27 -0700 Subject: [PATCH 2/2] doc: modernize and simplify man page * doc/grep.in.1 (Tx, Id): Remove. All uses removed. (MTO, URL): New macros, used for email and URL. Use them when appropriate. In main text, omit chatty discussions of other implementations; the full manual suffices for this sort of thing. --- doc/grep.in.1 | 168 ++++++++++++---------------------------------------------- 1 file changed, 35 insertions(+), 133 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 16b94b2..b6362ee 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -9,18 +9,17 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.ie t .ds Tx \s-1T\v'.4n'\h'-.1667'E\v'-.4n'\h'-.125'X\s0 -. el .ds Tx TeX -.de Id -. ds Yr \\$4 -. substring Yr 0 3 -. ds Mn \\$4 -. substring Mn 5 6 -. ds Dy \\$4 -. substring Dy 8 9 -. \" ISO 8601 date, complete format, extended representation -. ds Dt \\*(Yr-\\*(Mn-\\*(Dy +. +.ie \n[.g] .mso www.tmac +.el \{\ +. de MTO +\\$2 \(laemail: \\$1 \(ra\\$3 +.. +. de URL +\\$2 \(laURL: \\$1 \(ra\\$3 .. +.\} +. .TH GREP 1 \*(Dt "GNU grep @VERSION@" "User Commands" .hy 0 . @@ -46,64 +45,50 @@ grep, egrep, fgrep \- print lines matching a pattern .B grep searches the named input .IR FILE s -(or standard input if no files are named, -or if a single hyphen-minus -.RB ( \- ) -is given as file name) for lines containing a match to the given .IR PATTERN . +If no files are specified, or if the file +.RB "\*(lq" \- "\*(rq" +is given, +.B grep +searches standard input. By default, .B grep prints the matching lines. .PP -In addition, two variant programs +In addition, the variant programs .B egrep and .B fgrep -are available. -.B egrep -is the same as -.BR "grep\ \-E" . -.B fgrep -is the same as -.BR "grep\ \-F" . -Direct invocation as either -.B egrep -or -.B fgrep -is deprecated, -but is provided to allow historical applications -that rely on them to run unmodified. +are the same as +.B "grep\ \-E" +and +.BR "grep\ \-F" , +respectively. +These variants are deprecated, but are provided for backward compatibility. . .SH OPTIONS .SS "Generic Program Information" .TP .B \-\^\-help -Print a usage message briefly summarizing these command-line options -and the bug-reporting address, then exit. +Output a usage message and exit. .TP .BR \-V ", " \-\^\-version -Print the version number of +Output the version number of .B grep -to the standard output stream. -This version number should -be included in all bug reports (see below). +and exit. .SS "Matcher Selection" .TP .BR \-E ", " \-\^\-extended\-regexp Interpret .I PATTERN as an extended regular expression (ERE, see below). -.RB ( \-E -is specified by \s-1POSIX\s0.) .TP .BR \-F ", " \-\^\-fixed\-strings Interpret .I PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -.RB ( \-F -is specified by \s-1POSIX\s0.) .TP .BR \-G ", " \-\^\-basic\-regexp Interpret @@ -127,28 +112,20 @@ as the pattern. This can be used to specify multiple search patterns, or to protect a pattern beginning with a hyphen .RB ( \- ). -.RB ( \-e -is specified by \s-1POSIX\s0.) .TP .BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE Obtain patterns from .IR FILE , one per line. The empty file contains zero patterns, and therefore matches nothing. -.RB ( \-f -is specified by \s-1POSIX\s0.) .TP .BR \-i ", " \-\^\-ignore\-case Ignore case distinctions in both the .I PATTERN and the input files. -.RB ( \-i -is specified by \s-1POSIX\s0.) .TP .BR \-v ", " \-\^\-invert\-match Invert the sense of matching, to select non-matching lines. -.RB ( \-v -is specified by \s-1POSIX\s0.) .TP .BR \-w ", " \-\^\-word\-regexp Select only those lines containing matches that form whole words. @@ -161,8 +138,6 @@ Word-constituent characters are letters, digits, and the underscore. .TP .BR \-x ", " \-\^\-line\-regexp Select only those matches that exactly match the whole line. -.RB ( \-x -is specified by \s-1POSIX\s0.) .TP .B \-y Obsolete synonym for @@ -175,8 +150,6 @@ matching lines for each input file. With the .BR \-v ", " \-\^\-invert\-match option (see below), count non-matching lines. -.RB ( \-c -is specified by \s-1POSIX\s0.) .TP .BR \-\^\-color [ =\fIWHEN\fP "], " \-\^\-colour [ =\fIWHEN\fP ] Surround the matched (non-empty) strings, matching lines, context lines, @@ -203,8 +176,6 @@ Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. -.RB ( \-l -is specified by \s-1POSIX\s0.) .TP .BI \-m " NUM" "\fR,\fP \-\^\-max\-count=" NUM Stop reading a file after @@ -255,41 +226,9 @@ Also see the or .B \-\^\-no\-messages option. -.RB ( \-q -is specified by \s-1POSIX\s0.) .TP .BR \-s ", " \-\^\-no\-messages Suppress error messages about nonexistent or unreadable files. -Portability note: unlike \s-1GNU\s0 -.BR grep , -7th Edition Unix -.B grep -did not conform to \s-1POSIX\s0, because it lacked -.B \-q -and its -.B \-s -option behaved like \s-1GNU\s0 -.BR grep 's -.B \-q -option. -\s-1USG\s0-style -.B grep -also lacked -.B \-q -but its -.B \-s -option behaved like \s-1GNU\s0 -.BR grep . -Portable shell scripts -should avoid both -.B \-q -and -.B \-s -and should redirect standard and error output to -.B /dev/null -instead. -.RB ( \-s -is specified by \s-1POSIX\s0.) .SS "Output Line Prefix Control" .TP .BR \-b ", " \-\^\-byte\-offset @@ -324,8 +263,6 @@ option. .BR \-n ", " \-\^\-line\-number Prefix each line of output with the 1-based line number within its input file. -.RB ( \-n -is specified by \s-1POSIX\s0.) .TP .BR \-T ", " \-\^\-initial\-tab Make sure that the first character of actual line content lies on a @@ -789,37 +726,6 @@ versions .BR \e( , and .BR \e) . -.PP -Traditional -.B egrep -did not support the -.B { -meta-character, and some -.B egrep -implementations support -.B \e{ -instead, so portable scripts should avoid -.B { -in -.B "grep\ \-E" -patterns and should use -.B [{] -to match a literal -.BR { . -.PP -\s-1GNU\s0 -.B "grep\ \-E" -attempts to support traditional usage by assuming that -.B { -is not special if it would be the start of an invalid interval -specification. -For example, the command -.B "grep\ \-E\ '{1'" -searches for the two-character string -.B {1 -instead of reporting a syntax error in the regular expression. -\s-1POSIX\s0 allows this behavior as an extension, but portable scripts -should avoid it. . .SH "ENVIRONMENT VARIABLES" The behavior of @@ -1164,12 +1070,12 @@ not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH BUGS .SS "Reporting Bugs" Email bug reports to -.RB < bug\-grep@gnu.org >, -a mailing list whose web page is -.RB < http://lists.gnu.org/mailman/listinfo/bug\-grep >. -.BR grep 's -bug tracker is located at -.RB < http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep >. +.MTO bug-grep@gnu.org "the bug-reporting address" . +An +.URL http://lists.gnu.org/mailman/listinfo/bug-grep "email archive" +and a +.URL http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep "bug tracker" +are available. .SS "Known Bugs" Large repetition counts in the .BI { n , m } @@ -1194,11 +1100,10 @@ terminfo(5), glob(7), regex(7). .SS "\s-1POSIX\s0 Programmer's Manual Page" grep(1p). -.SS "\*(Txinfo Documentation" -The full documentation for -.B grep -is maintained as a \*(Txinfo manual, -which you can read at http://www.gnu.org/software/grep/manual/. +.SS "Full Documentation" +A +.URL http://www.gnu.org/software/grep/manual/ "complete manual" +is available. If the .B info and @@ -1212,8 +1117,5 @@ should give you access to the complete manual. .SH NOTES This man page is maintained only fitfully; the full documentation is often more up-to-date. -.PP -\s-1GNU\s0's not Unix, but Unix is a beast; -its plural form is Unixen. .\" Work around problems with some troff -man implementations. .br -- 1.9.3 --------------010203040501070006040509-- From unknown Tue Jun 24 05:13:29 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18651: Clarify exit status description Resent-From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Wed, 08 Oct 2014 08:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18651 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert Cc: 18651@debbugs.gnu.org Received: via spool by 18651-submit@debbugs.gnu.org id=B18651.141275790325944 (code B ref 18651); Wed, 08 Oct 2014 08:46:01 +0000 Received: (at 18651) by debbugs.gnu.org; 8 Oct 2014 08:45:03 +0000 Received: from localhost ([127.0.0.1]:37359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xbmrm-0006kH-I1 for submit@debbugs.gnu.org; Wed, 08 Oct 2014 04:45:03 -0400 Received: from mx1.riseup.net ([198.252.153.129]:43174) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xbmrj-0006jZ-8w for 18651@debbugs.gnu.org; Wed, 08 Oct 2014 04:45:00 -0400 Received: from berryeater.riseup.net (berryeater-pn.riseup.net [10.0.1.120]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Gandi Standard SSL CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id B001946644; Wed, 8 Oct 2014 01:44:57 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id C7205427AF Received: by nomada (sSMTP sendmail emulation); Wed, 08 Oct 2014 10:44:53 +0200 Date: Wed, 8 Oct 2014 10:44:53 +0200 From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Message-ID: <20141008084452.GA26857@nomada> References: <20141007093618.GA15806@nomada> <54341456.5030904@cs.ucla.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54341456.5030904@cs.ucla.edu> User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Scanned: clamav-milter 0.98.4 at mx1 X-Virus-Status: Clean X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Control: tags -1 + patch El 07/10/14 a las 09:27, Paul Eggert escribió: > Hmmm, well, to me the proposed clarification is not that clear either. And > the man page is no place for a chatty discussion about what POSIX allows of > other implementations; the full manual is the place for that sort of thing. > So, how about the attached patches instead? I've pushed them. Thanks. And here you have remaining doc-related changes included in Debian. Cheers, Santiago --gBBFr7Ir9EOA20Yy Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="grep-clarify-docs.patch" >From 99ddde23dc02f10fb4ed37e0463209dd557d9b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ruano=20Rinc=C3=B3n?= Date: Wed, 8 Oct 2014 09:51:51 +0200 Subject: [PATCH] Doc minor changes * doc/grep.in.1, doc/grep/texi: clarify info related to -F, -x, PCRE and the matchers. --- doc/grep.in.1 | 16 ++++++++++------ doc/grep.texi | 11 ++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index b6362ee..a480069 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -87,8 +87,8 @@ as an extended regular expression (ERE, see below). .BR \-F ", " \-\^\-fixed\-strings Interpret .I PATTERN -as a list of fixed strings, separated by newlines, -any of which is to be matched. +as a list of fixed strings (rather than regular expressions), separated +by, separated by newlines, any of which is to be matched. .TP .BR \-G ", " \-\^\-basic\-regexp Interpret @@ -99,7 +99,7 @@ This is the default. .BR \-P ", " \-\^\-perl\-regexp Interpret .I PATTERN -as a Perl regular expression. +as a Perl regular expression (PCRE, see below). This is highly experimental and .B "grep \-P" may warn of unimplemented features. @@ -138,6 +138,10 @@ Word-constituent characters are letters, digits, and the underscore. .TP .BR \-x ", " \-\^\-line\-regexp Select only those matches that exactly match the whole line. +This option has the same effect as anchoring the expression with +.BR ^ +and +.BR $ . .TP .B \-y Obsolete synonym for @@ -524,7 +528,7 @@ expressions, by using various operators to combine smaller expressions. .PP .B grep understands three different versions of regular expression syntax: -\*(lqbasic,\*(rq \*(lqextended\*(rq and \*(lqperl.\*(rq In +\*(lqbasic\*(rq (BRE), \*(lqextended\*(rq (ERE) and \*(lqperl\*(rq (PRCE). In .RB "\s-1GNU\s0\ " grep , there is no difference in available functionality between basic and extended syntaxes. @@ -532,8 +536,8 @@ In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl regular expressions give additional functionality, and are -documented in pcresyntax(3) and pcrepattern(3), but may not be -available on every system. +documented in pcresyntax(3) and pcrepattern(3), but only work if pcre +is available in the system. .PP The fundamental building blocks are the regular expressions that match a single character. diff --git a/doc/grep.texi b/doc/grep.texi index da9a1be..a7ae8c6 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -239,8 +239,9 @@ Word-constituent characters are letters, digits, and the underscore. @opindex -x @opindex --line-regexp @cindex match the whole line -Select only those matches that exactly match the whole line. -(@option{-x} is specified by POSIX.) +Select only those matches that exactly match the whole line. This option +has the same effect as anchoring the expression with @samp{^} and +@samp{$}. (@option{-x} is specified by POSIX.) @end table @@ -1070,8 +1071,8 @@ Interpret the pattern as an extended regular expression (ERE). @opindex -F @opindex --fixed-strings @cindex matching fixed strings -Interpret the pattern as a list of fixed strings, separated -by newlines, any of which is to be matched. +Interpret the pattern as a list of fixed strings (rather than regular +expressions), separated by newlines, any of which is to be matched. (@option{-F} is specified by POSIX.) @item -P @@ -1113,7 +1114,7 @@ The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl regular expressions give additional functionality, and are documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual pages, -but may not be available on every system. +but only work if pcre is available in the system. @menu * Fundamental Structure:: -- 2.1.0 --gBBFr7Ir9EOA20Yy-- From unknown Tue Jun 24 05:13:29 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Subject: bug#18651: closed (Re: bug#18651: Clarify exit status description) Message-ID: References: <5684ED30.90903@cs.ucla.edu> <20141007093618.GA15806@nomada> X-Gnu-PR-Message: they-closed 18651 X-Gnu-PR-Package: grep Reply-To: 18651@debbugs.gnu.org Date: Thu, 31 Dec 2015 08:55:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1451552102-20655-1" This is a multi-part message in MIME format... ------------=_1451552102-20655-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #18651: Clarify exit status description which was filed against the grep package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 18651@debbugs.gnu.org. --=20 18651: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18651 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1451552102-20655-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 18651-done) by debbugs.gnu.org; 31 Dec 2015 08:54:17 +0000 Received: from localhost ([127.0.0.1]:50931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEYzx-0005M4-6G for submit@debbugs.gnu.org; Thu, 31 Dec 2015 03:54:17 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41840) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEYzv-0005Lo-8H for 18651-done@debbugs.gnu.org; Thu, 31 Dec 2015 03:54:15 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id AEAC1160ED0; Thu, 31 Dec 2015 00:54:09 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id F9k_fq5Wskzf; Thu, 31 Dec 2015 00:54:08 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8D11F160ED6; Thu, 31 Dec 2015 00:54:08 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8DUOEQCY6ft0; Thu, 31 Dec 2015 00:54:08 -0800 (PST) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 685CA160ED0; Thu, 31 Dec 2015 00:54:08 -0800 (PST) To: 18651-done@debbugs.gnu.org, =?UTF-8?Q?Santiago_Ruano_Rinc=c3=b3n?= From: Paul Eggert Subject: Re: bug#18651: Clarify exit status description Organization: UCLA Computer Science Department Message-ID: <5684ED30.90903@cs.ucla.edu> Date: Thu, 31 Dec 2015 00:54:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040108010006080300060100" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 18651-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------040108010006080300060100 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > here you have remaining doc-related changes included in Debian. Thanks. I installed the attached patch, which should fix the problems noted (though with different wording), and am marking this bug as done. --------------040108010006080300060100 Content-Type: text/x-diff; name="0001-doc-minor-clarifications.patch" Content-Disposition: attachment; filename="0001-doc-minor-clarifications.patch" Content-Transfer-Encoding: quoted-printable >From f61187acad67bf34cd1fd9fbbacd2a0a8fb054b1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 31 Dec 2015 00:50:43 -0800 Subject: [PATCH] doc: minor clarifications MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * doc/grep.in.1, doc/grep.texi: Minor clarifications suggested by Debian documentation patches. Problem reported by Santiago Ruano Rinc=C3=B3n in: http://bugs.gnu.org/18651 --- doc/grep.in.1 | 17 ++++++++++++----- doc/grep.texi | 8 +++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 2b513a8..8938478 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -87,7 +87,8 @@ as an extended regular expression (ERE, see below). .BR \-F ", " \-\^\-fixed\-strings Interpret .I PATTERN -as a list of fixed strings, separated by newlines, +as a list of fixed strings (instead of regular expressions), +separated by newlines, any of which is to be matched. .TP .BR \-G ", " \-\^\-basic\-regexp @@ -99,7 +100,7 @@ This is the default. .BR \-P ", " \-\^\-perl\-regexp Interpret .I PATTERN -as a Perl regular expression. +as a Perl regular expression (PCRE, see below). This is highly experimental and .B "grep \-P" may warn of unimplemented features. @@ -138,6 +139,11 @@ Word-constituent characters are letters, digits, and= the underscore. .TP .BR \-x ", " \-\^\-line\-regexp Select only those matches that exactly match the whole line. +For a regular expression pattern, this is like parenthesizing the +pattern and then surrounding it with +.B ^ +and +.BR $ . .TP .B \-y Obsolete synonym for @@ -531,7 +537,8 @@ expressions, by using various operators to combine sm= aller expressions. .PP .B grep understands three different versions of regular expression syntax: -\*(lqbasic,\*(rq \*(lqextended\*(rq and \*(lqperl.\*(rq In +\*(lqbasic\*(rq (BRE), \*(lqextended\*(rq (ERE) and \*(lqperl\*(rq (PCRE= ). +In .RB "\s-1GNU\s0\ " grep , there is no difference in available functionality between basic and extended syntaxes. @@ -539,8 +546,8 @@ In other implementations, basic regular expressions a= re less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl regular expressions give additional functionality, and are -documented in pcresyntax(3) and pcrepattern(3), but may not be -available on every system. +documented in pcresyntax(3) and pcrepattern(3), but work only if +PCRE is available in the system. .PP The fundamental building blocks are the regular expressions that match a single character. diff --git a/doc/grep.texi b/doc/grep.texi index 58e7f48..73151e4 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -240,6 +240,8 @@ Word-constituent characters are letters, digits, and = the underscore. @opindex --line-regexp @cindex match the whole line Select only those matches that exactly match the whole line. +For a regular expression pattern, this is like parenthesizing the +pattern and then surrounding it with @samp{^} and @samp{$}. (@option{-x} is specified by POSIX.) =20 @end table @@ -1091,8 +1093,8 @@ Interpret the pattern as an extended regular expres= sion (ERE). @opindex -F @opindex --fixed-strings @cindex matching fixed strings -Interpret the pattern as a list of fixed strings, separated -by newlines, any of which is to be matched. +Interpret the pattern as a list of fixed strings (instead of regular +expressions), separated by newlines, any of which is to be matched. (@option{-F} is specified by POSIX.) =20 @item -P @@ -1134,7 +1136,7 @@ The following description applies to extended regul= ar expressions; differences for basic regular expressions are summarized afterwards. Perl regular expressions give additional functionality, and are documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual pages, -but may not be available on every system. +but work only if PCRE is available in the system. =20 @menu * Fundamental Structure:: --=20 2.5.0 --------------040108010006080300060100-- ------------=_1451552102-20655-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Oct 2014 09:36:48 +0000 Received: from localhost ([127.0.0.1]:36185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbRCK-00035Z-3q for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35705) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XbRCI-00035P-1t for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbRCC-00075G-9r for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:45 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_50,UNPARSEABLE_RELAY, URIBL_RHS_DOB autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRCC-00075C-7T for submit@debbugs.gnu.org; Tue, 07 Oct 2014 05:36:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRC7-0002VI-0Y for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbRC2-00073k-2S for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:34 -0400 Received: from mx1.riseup.net ([198.252.153.129]:52116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRC1-00072A-QG for bug-grep@gnu.org; Tue, 07 Oct 2014 05:36:30 -0400 Received: from berryeater.riseup.net (berryeater-pn.riseup.net [10.0.1.120]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Gandi Standard SSL CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id D3018494CC for ; Tue, 7 Oct 2014 02:36:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id 3D16C435B1 Received: by nomada (sSMTP sendmail emulation); Tue, 07 Oct 2014 11:36:18 +0200 Date: Tue, 7 Oct 2014 11:36:18 +0200 From: Santiago Ruano =?iso-8859-1?Q?Rinc=F3n?= To: bug-grep@gnu.org Subject: Clarify exit status description Message-ID: <20141007093618.GA15806@nomada> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XOIedfhf+7KOe/yw" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Scanned: clamav-milter 0.98.4 at mx1 X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.7 (----) --XOIedfhf+7KOe/yw Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Disposition: inline --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I'm attaching to this mail an old proposal to clarify the exit status description, included in the debian package: https://bugs.debian.org/446854 Regards, Santiago --huq684BweRXVnRxX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="grep-man-exit-status-1.patch" Content-Transfer-Encoding: quoted-printable =46rom 2432287712e802ce821e3158fb4f40a1a7b8b436 Mon Sep 17 00:00:00 2001 =46rom: =3D?UTF-8?q?Santiago=3D20Ruano=3D20Rinc=3DC3=3DB3n?=3D Date: Tue, 7 Oct 2014 11:19:56 +0200 Subject: [PATCH] Simplify EXIT STATUS information * doc/grep.in.1, doc/grep.texi: clarify information regarding exit status. "A. Costa" wrote the original patch. See: https://bugs.debian.org/446854 --- doc/grep.in.1 | 16 ++++------------ doc/grep.texi | 14 ++++---------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/doc/grep.in.1 b/doc/grep.in.1 index 00d030a..44da7e9 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -1143,23 +1143,15 @@ when is not set. . .SH "EXIT STATUS" -Normally, the exit status is 0 if selected lines are found and 1 otherwise. -But the exit status is 2 if an error occurred, unless the +The exit status is 0 if selected lines are found, and 1 if not found. +If an error occurred (and .B \-q or .B \-\^\-quiet 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. +are not used) the exit status is 2. (Note: POSIX error +handling code should check for '2' or greater.) . .SH COPYRIGHT Copyright 1998-2000, 2002, 2005-2014 Free Software Foundation, Inc. diff --git a/doc/grep.texi b/doc/grep.texi index d7adcad..46361ce 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -1025,16 +1025,10 @@ and only when @env{POSIXLY_CORRECT} is not set. @cindex exit status @cindex return status =20 -Normally, the 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 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. +The exit status is 0 if selected lines are found, and 1 if not found. If +an error occurred (and @option{-q} or @option{--quiet} or +@option{--silent} are not used) the exit status is 2. (Note: POSIX error +handling code should check for '2' or greater. =20 =20 @node grep Programs --=20 2.1.0 --huq684BweRXVnRxX-- --XOIedfhf+7KOe/yw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUM7QRAAoJELPyXWsAqAZiT1gP/18OZOKYd1y62f0f1g9BUTCo lR+j2PujPIU1TMdsYlWGvc/Nl5cWnZatkNlIzGuCo+1lStrO/7T9oNsgNk4XXWx5 Gzpxy5ENMGGjlHDT6CN5THZuid2WyshFmPuz4pVNAOu4j9STcW6/qQeFbmre6+66 8BcPO8qo+12HOGustE6OwcfIA40sFpUuHNWVNr9R44ZUmyqWlBAzc8qWpVMkQs41 Tt8Ypvp6aaKUTxEp9pVlvla+um4Z1QvrBEt3h+rrDa+NRjN/6XHtQM7egN9DPmDu n0+ktGCzRZepuFACP4t5pbSy3KwFSzAq0TRrHo0tMX9eHJNcsPYY7L1Ll9LfeNVw 3Zh57VvunVwUuBQqEvSoY1HbNEJRa1H0EGD+zxe5HGZmxl4fYSSgXOCVod4QO9od dJsncKF+zye+UV9bbfJtjHA6KnuPtmCErxKnx36P4IAK6ZGvGMPGKvkKYO5NCPuB ezL0ZNfTk9fmdC8SQEhhH2/IPPV1TYj/9+/YCBRfKC9mG1m+jjd/WjuS05OW956o WDp5XjCng25TjYDTAIPdx4bvRCITjn5kRV+3KYf58CejMzkiYlzi99/qjm+UPnEB Amq3WP6v7wDphQYWFQ3z5Ysw37v5lvjKNFC05aUsPuTSSFEhUGHgRGyrwEXJ4vyt zH+dFjC/OFKCdAZ2j2Ao =KoWe -----END PGP SIGNATURE----- --XOIedfhf+7KOe/yw-- ------------=_1451552102-20655-1--