bug-bash
[Top][All Lists]
Advanced

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

Re: -e does not work with subscript


From: Stepan Koltsov
Subject: Re: -e does not work with subscript
Date: Tue, 29 Jan 2008 22:41:16 +0300

BTW, my use case for "(false)" is:

===
set -e
( cd some-dir && make )
( cd other-dir && ./build.sh )
( cd third-dir && ant )
===

Most readers (and writers) expect script to fail if "make" failed. So
I think that outer bash should exit with error on "(false)" :-)

Of course, script can be rewritten as

===
( cd some-dir && make ) || false
===

S.

On 1/29/08, Pierre Gaston <pierre.gaston@gmail.com> wrote:
> On Jan 29, 2008 8:09 PM, Stepan Koltsov <yozh@mx1.ru> wrote:
> > What is "simple command"?
> >
> > Is
> >
> > ===
> > ( false ) || false
> > ===
> >
> > simple? Seems like it is not, however
> >
> > ===
> > set -e
> >
> > ( false ) || false
> >
> > echo "end"
> > ===
> >
> > Prints nothing and exits with error.
>
> Indeed according to man bash, this is a list It is perhaps possible to
> consider that the last false is executed as a simple
> command but I think the documentation of set -e could perhaps be made
> more clear about what happens when
> the last command of a list exits with non 0.
>
> I understand why it is implemented this way, so that any non processed
> error exits the shell.
>
> The shells seems to disagree on what (false) should do (ksh and zsh
> exit the shell, dash and bash only the subshell.
> They also seems to disagree on what ! true should do ( zsh exits, bash
> dash and ksh don't)
>




reply via email to

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