GNU bug report logs - #28105
Inconsistent exit code with --files-without-match

Previous Next

Package: grep;

Reported by: Anthony Sottile <asottile <at> umich.edu>

Date: Tue, 15 Aug 2017 22:24:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Anthony Sottile <asottile <at> umich.edu>, 28105 <at> debbugs.gnu.org
Subject: Re: bug#28105: Inconsistent exit code with --files-without-match
Date: Tue, 15 Aug 2017 22:15:03 -0700
Anthony Sottile wrote:
> # Search is for filenames not containing hi, this search is successful
> **but it exits 1**
> $ grep -L hi -- f; echo $?
> f
> 1
> # Search is for filenames not containing hello, this search fails
> **but it exits 0**
> $ grep -L hello -- f; echo $?
> 0

The grep documentation says exit status depends on whether lines (not files) are 
selected, so grep is conforming to its documentation here. Perhaps grep's 
documentation and behavior could be changed, though I worry that existing uses 
of grep might be adversely affected. What is the use case that justifies such a 
change?




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

Previous Next


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