> >
> > Go strictly from left to right.
>
> How do you assign something that hasn't been evaluated yet? Evaluating the
> expression on the RHS is an absolute prerequisite to evaluating the
> assignment
> itself. (x += x) = 1 is nonsense. It evaluates to 0 = 1.
It makes sense, depending on the
>
> Is it specified what the value of x should be after this expression?
Typically assignment cascades (including the op= variants) are
evaluated from right to left...
>
> x=0; : $((x+=x=1))
...so this would produce 2.
>
> Bash, ksh93, mksh, posh say 1. zsh, dash, busybox say 2. Clang and gc
On 09.04.2012 19:31, Dan Stromberg wrote:
>
> What should be the behavior of the following?
>
> if cmd1
> then
> cmd2
> fi && if cmd3
> then
>cmd4
> fi
If cmd1 is true then execute cmd2;
cmd2 defines the exit code for the first if
depending on cmd2 return value,
if true then the subs