bug-grep
[Top][All Lists]
Advanced

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

bug#28105: Inconsistent exit code with --files-without-match


From: Paul Eggert
Subject: bug#28105: Inconsistent exit code with --files-without-match
Date: Tue, 15 Aug 2017 22:15:03 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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?





reply via email to

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