On Wed, Jun 05, 2019 at 08:05:48PM +0200, Andreas Kusalananda Kähäri wrote:
> When running under set -e, why does
>
> eval false || echo ok
Just to clarify:
OpenBSD's sh(1) and ksh(1) make it impossible to run code like
set -e
if eval "$string"; then
echo ok
else
echo not ok
fi
where "$string" is a piece of code that returns a non-zero exit status.
This script would not output anything with string=false, for example,
even though the eval occurs as a test within a conditional statement.
>
> terminate the script with the execution of eval? As far as I know, the
> OpenBSD sh(1) and ksh(1) shells are the only ones doing that.
>
> If we take termination of the script as a given in the above scenario
> (even if it feel a bit odd since it's in an AND-OR list), then why does
> the below behave differently?
>
> eval ! true || echo ok
>
> This would not terminate the shell regardless of set -e or not.
>
> Is that a bug or is it a different interpretation of the standard?
>
>
>
> --
> Kusalananda
> Sweden
--
Kusalananda
Sweden