Wednesday, June 05, 2019

Behaviour of eval in sh(1) and ksh(1) in AND-OR list with set -e

When running under set -e, why does

eval false || echo ok

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

No comments:

Post a Comment