So... > # make this work with (ba)sh \ > command -v shopt && shopt -s expand_aliases;\ > alias p=printf;alias e=echo;alias s=export > s I1=10 I2=20;p "<$((I1+=I2+=I1+=I2))>";e "<$I1><$I2>" > s I1=10 I2=20;p "<$((I1+=I2+=I1+=I1))>";e "<$I1><$I2>" > > which gives for my code > #?0|kent:tmp$ busybox.static sh t2.sh > <80><80><50> > <60><60><40> > > and for bash and plain bb > > #?0|kent:tmp$ bash t2.sh > shopt > <60><60><50> > <50><50><40> > ...$ busybox sh t2.sh > <60><60><50> > <50><50><40> > > Where a C proof (what i want) gives > ... > <80><50> > <60><40>
more simply for a weak mind like mine a=1 b=2; echo $((a+=b+=a+=b)) parsing it from right to left : a=a+b=1+2=3 then b=b+a=2+3=5 and finally a=a+b=3+5=8 BUT, indeed, bAsh returns 6 however bb 1.37 gave me the expected 8 my question will then be, with all due respect for the demonstration you given, Was ist das? more precisely, how is it related to the ternary operator (construct 'a?b:c') ? You end up writting about "recursed conditionals" but though i can imagine a form of stack recursion to parse the above cascade of "+=", i pain to witness the conditional side of it. Sorry for not seeing what might be ovious for you so maybe can you help me connecting the dots? Be the night a good friend to us all, Jclu 202510142 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
