On Sun, 28 Feb 2016 04:26:13 +0700
Robert Elz <[email protected]> wrote:
> | > sh -c 'set -e; false && false; echo foo'
>
> the shell given the comamnd above should exit(1) and not print "foo"
> when the 2nd of the two "false" commands is executed.
...
> When the first "false" in false && false is executed, its exit
> status is being checked by the && operator, so -e does not apply to
> it. (Everyone agrees with this.)
I must be missing something. The second false should never execute,
whether or not -e is in force.
It's ancient and common practice to use short-circuiting, as in:
$ test -f foo && echo yes
$
Given "false && X", X never executes, -e or no.
IMO, in the presence of -e, "false && false" should terminate
execution, just as "false && true" should. The entire compound
statement is false because the first one is.
--jkl