[Top][All Lists]

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

bug#38792: man grep

From: Stephane Chazelas
Subject: bug#38792: man grep
Date: Sun, 29 Dec 2019 19:10:51 +0000
User-agent: NeoMutt/20180716

2019-12-29 10:46:10 -0800, Paul Eggert:
> On 12/29/19 6:24 AM, Martin Simons wrote:
> > It may not be the task of the grep project to provide a man page, but even 
> > then I
> > feel there is an opportunity for improvement here
> Right on both counts. I installed the attached patches to improve things a bit
> in the next version of grep.

> From 8b7da49786e613c6ae9a2b299b1ce2187b32ed26 Mon Sep 17 00:00:00 2001
> Subject: [PATCH 1/2] doc: document quoting better
> +Normally the exit status is 0 if a line is selected, 1 if no lines
> +were selected, and 2 if an error occurred.

Note that that wording makes it unclear what the exit status
should be if -o is in use.

> +$ \fBgrep\fP \-n 'f.*\e.c$' *g*.h /dev/null

It should be

grep -n -- 'f.*\.c$' *g*.h /dev/null


grep -ne 'f.*\.c$' -- *g*.h /dev/null

(unless $POSIXLY_CORRECT is set).

grep pattern *.h

is fine in POSIX compliant greps, but not in GNU grep as GNU
getopt*() accept options after non-option arguments. IMO, it's
worth pointing out as it's a common gotchas with GNU utilities.

grep -e pattern *.h

is not fine in any grep.

(why not using -H instead of /dev/null btw?).

> +@example
> +$ @kbd{grep -n 'f.*\.c$' *g*.h /dev/null}
> +argmatch.h:1:/* definitions and prototypes for argmatch.c
> +@end example

same in texinfo.


reply via email to

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