Le 24/09/2010 14:52, Sascha Ziemann a écrit :

> The expression:
> 
> declare a='x'$(false)
> 
> means: concatenate the string 'x', which evaluates to itself, and the
> output of a sub shell, which performs the false command, and assign
> the concatenated value to the variable a.
> 
> This means that the sub shell fails *before* 'declare' starts. So I
> think it should not matter what declare returns, because the script
> should have been terminated already.

The *subshell* exits. But this does not force its "declaring" parent
script to exit.


Also note this difference:

set -e ; declare a=$(         false; echo something ); echo $a
  => "something"
set -e ; declare a=$( set -e; false; echo something ); echo $a
  => <nothing>



Reply via email to