Hi,

another example of this (mis)behaviour:

set -e

fn() {
  false
  echo "still running"
}

fn && echo "didn't fail"
if fn; then echo "didn't fail"; fi
eval fn && echo "didn't fail"
while fn; do echo "looping forever"; done


I think every single shell misbehaves on those. Bash and zsh do it
consistently for all. Dash seems to fail differently on eval.

The docs for "-e" say that complex statements disable the -e (or &&,
||, if, while,.. wouldn't work). But I think for functions or { ... }
statements that is wrong. The -e should be handled as if a subshell
was forked. The first comand failing in the sub statement should
abort, set the return code and evaluate the rest of the complex
statement.

MfG
        Goswin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to