bug-bash
[Top][All Lists]
Advanced

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

Re: errexit inconsistent behaviour with pipelines


From: Marcin Owsiany
Subject: Re: errexit inconsistent behaviour with pipelines
Date: Mon, 6 Oct 2008 21:56:34 +0100
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

On Mon, Oct 06, 2008 at 04:09:49PM -0400, Chet Ramey wrote:
> > That's the case that's behaving correctly, even though it's not the
> > way you want it to behave.  Neither case should terminate the shell.
> > Only a simple command should terminate the shell, and a pipeline is
> > not a simple command, even if its components are.  Chet is saying that
> > the next bash release will fix this bug - meaning that "true | false"
> > will no longer cause the shell to exit.
> 
> Yes.  I'm sorry that I was not as clear as I should have been.

Oh, I certainly didn't expect it to be fixed this way :-)

Will setting pipefail have any effect on this? If not, then is there a
way to make bash abort when one of the pipeline components fails,
without too much additional code?

On the other hand, to match the documentation, you would also have to
fix cases such as:

set -e
true && false
echo done

As they are not simple commands either, right? The manpage even
explicitly says that it "does not exit if the command that fails is
[...] part of a && or  ││ list".

Marcin
-- 
Marcin Owsiany <marcin@owsiany.pl>              http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216
 
"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown




reply via email to

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