On 2007-12-10 16:26:37 +0000, Gerrit Pape wrote:
> Yes.  set and shift are so called 'special builtins', and show different
> behavior on errors, as documented here:
> 
>  
> http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_14
>  http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html
>  
> http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_08_01
> 
> So dash is right, it should exit an interactive shell on, e.g., the 'set
> -o pipefail' error.

OK, well, I think you meant "non-interactive shell" here.
Now...

vin:~> dash -c 'set -o foo; echo "Didn''t abort ($?)"'
set: 1: Illegal option -o foo
zsh: exit 2     dash -c 'set -o foo; echo "Didn't abort ($?)"'

vin:~> ksh93 -c 'set -o foo; echo "Didn''t abort ($?)"'
ksh93[1]: set: foo: bad option(s)
Usage: set [-sabefhkmnprtuvxBCGH] [-A name] [-o[option]] [arg ...]
zsh: exit 2     ksh93 -c 'set -o foo; echo "Didn't abort ($?)"'

vin:~> bash -c 'set -o foo; echo "Didn''t abort ($?)"'
bash: line 0: set: foo: invalid option name
Didn't abort (1)

vin:~> zsh -c 'set -o foo; echo "Didn''t abort ($?)"'
set: no such option: foo
Didn't abort (0)

vin:~> zsh -c 'emulate sh; set -o foo; echo "Didn''t abort ($?)"'
set: no such option: foo
Didn't abort (0)

So, if I understand correctly, dash and ksh93 are correct, bash is
wrong, and zsh is very wrong.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


Reply via email to