I noticed something strange while executing some 'eval'-ed commands: the -e/-o errexit appears to become active out of nowhere.

$ mksh -c 'echo $-; eval '\''echo $-'\''; echo $-'
hc
ehc
hc

But it looks like it's appearances only; it's not actually effective.

$ mksh -c 'eval '\''echo $-; false; echo phantom e'\'
ehc
phantom e

I tested mksh versions down to R49 and they all have this bug. However, its ancestor pdksh does not have this bug.

However, both pdksh and mksh render 'set -e' ineffective for eval'ed commands, which is a bug in itself; no other shell including ksh93 shares this behaviour. Thus the expected output for the last command above is 'hc' and nothing else.

Thanks,

- M.

--
modernish -- harness the shell
https://github.com/modernish/modernish

Reply via email to