Greg Wooledge <g...@wooledge.org> writes:
> On Fri, May 13, 2022 at 10:36:56PM -0400, Dale R. Worley wrote:
>> Reading your message, I believe that the rule can be stated as follows,
>> and I'd thank you to check it:  && and || have the same precedence, and
>> they both "associate left".  So for example
>>     x && yy || zz
>> is equivalent (as a control structure) to
>>     { x && yy ;} || zz
>
> Not really.  Let's say you have a bunch of commands strung together like
> this:
>
> a && b || c && d || e && f || g
[ most of the exposition snipped ]
> And so on, until the entire line has been processed.  Each simple command
> in the line is either executed, or not, depending on the current value
> of $? and the operator which precedes it.
>
> That's why this has no equivalence to a regular "if/then/else" command.
> The implementation is just entirely different.

Uh, I didn't say it was equivalent to a 'regular "if/then/else"'
command, I said it was equivalent to

   { { { { { a && b ;} || c ;} && d ;} || e ;} && f ;} || g

which indeed has the same effect as you described in your message.

Dale

Reply via email to