GNU bug report logs - #38792
man grep

Previous Next

Package: grep;

Reported by: Martin Simons <martin <at> webhuis.nl>

Date: Sun, 29 Dec 2019 15:19:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephane Chazelas <stephane.chazelas <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: Re: bug#38792: man grep
Date: Sun, 29 Dec 2019 19:10:51 +0000
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
[...]
> +.SH "EXIT STATUS"
> +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

Or:

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.

-- 
Stephane





This bug report was last modified 4 years and 238 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.