GNU bug report logs -
#54035
Patch for easier use in scripting pipelines
Previous Next
Full log
Message #17 received at 54035 <at> debbugs.gnu.org (full text, mbox):
On Sat, 19 Feb 2022 08:01:20 -0800
Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> bash --norc --noprofile -c 'set -eo pipefail; cat
> /usr/share/dict/american-english | grep -l "^"; echo done'
>
> the output is:
>
> (standard input)
>
> which means that Bash exited without doing the 'echo done'.
I'm running fish as shell, and that doesn't do that. Using bash, it
behaves as you describe. Just for my understanding, grep stops reading
when it finds the first match and then the shell closes the output
stream of cat. That in turn causes cat to fail (exit code 141, meaning
SIGPIPE), because it can't write the rest of the data that it wants,
right?
In any case, you have delivered some convincing arguments. I'll turn my
attention on the manpage instead. The benchmark (if that's what you
want to call it) that brought me to this was that grep behaviour
confused me and that I couldn't find anything even from reading the
docs. I think that short reads (which could cause SIGPIPE) and the
non-error exit code 1 deserve mention there. I'll take a look and
perhaps file another patch.
So long...
Uli
This bug report was last modified 3 years and 146 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.