bug#54035: Patch for easier use in scripting pipelines

2022-02-17 Thread Ulrich Eckhardt
Greetings! The attached patch add a `--pipe` option to grep. When used, grep only exits with with nonzero status on error. In particular, it doesn't signal "match" / "no match" through the exit code. Here's an example using Bash: # enable automatic error handling set -eo pipefail # grep fo

bug#54043: Simple regexp bug [contains spoiler for today's wordle]

2022-02-17 Thread Matthew Wilcox
I noticed this one while doing: $ grep sha[^s]e five-letter-words share which doesn't fit with: $ grep sha.e five-letter-words shade shake shale shame shape share shave A reproducer is easy: $ echo shame |grep sha[^s]e (no output) Almost any change to the regex & input will make it work, even

bug#54043: Simple regexp bug [contains spoiler for today's wordle]

2022-02-17 Thread Jim Meyering
On Thu, Feb 17, 2022 at 7:46 AM Matthew Wilcox wrote: > I noticed this one while doing: > > $ grep sha[^s]e five-letter-words > share > > which doesn't fit with: > > $ grep sha.e five-letter-words > shade > shake > shale > shame > shape > share > shave > > A reproducer is easy: > > $ echo shame |g

bug#54043: Acknowledgement (Simple regexp bug [contains spoiler for today's wordle])

2022-02-17 Thread Matthew Wilcox
Never mind. bash glob-expanded 'sha[^s]e' to match 'share' which was a directory in $HOME. Eventually, I'll learn to quote correctly.

bug#54035: Patch for easier use in scripting pipelines

2022-02-17 Thread Paul Eggert
On 2/16/22 23:57, Ulrich Eckhardt wrote: In order to fix that bug in the above script, you currently have to replace `grep ...` with `grep ... || [ $? = 1 ]`, which is not really readable. Actually, appending something "|| test $? -eq 1" looks readable to me; plus, it already works and is port