The following reply was made to PR user/6481; it has been noted by GNATS.
From: Jason McIntyre <[email protected]>
To: [email protected]
Cc:
Subject: Re: user/6481: /bin/sh does not honor the errexit option for command
lists with && or ||
Date: Fri, 8 Oct 2010 20:04:26 +0100
On Fri, Oct 08, 2010 at 08:34:54PM +0200, Tilo Stritzky wrote:
> >Description:
> When a command list contains && or ||, a set errexit option
> does not cause the shell to exit if the last command in the
> list returns non-zero.
> >How-To-Repeat:
> /bin/sh -ec 'true && false ; echo $?, still alive'
> /bin/ksh -ec 'false || false ; echo $?, still alive'
the description of -e says as much:
-e | errexit
Exit (after executing the ERR trap) as soon as an error occurs or
a command fails (i.e. exits with a non-zero status). This does
not apply to commands whose exit status is explicitly tested by a
shell construct such as if, until, while, &&, ||, or ! statements.
jmc