Ralph (5) [Avatar] Offline

I'm your posterchild UNIX scripter and I'm baffled.

I guess I don't follow the logic of the (sometimes written with 'or' and sometimes with 'and') LAST loop condition. (pages 352 top vs 353 top.)

Maybe it's obvious but not right now...

Ralph (5) [Avatar] Offline
Re: 10.6.3 (or last) vs (and last)
Ralph has had his EUREKA moment.
left to right precedence does it all.

Thanks Ralph
tmaher (37) [Avatar] Offline
Re: 10.6.3 (or last) vs (and last)
Seems like you figured it out, but for the benefit of other readers, it comes down to this.
The loops at the top of p. 352 and p. 353 are both designed to execute <TT>last</TT> when the <TT>condition</TT> is False, using <TT>or last</TT>, but, the "compound condition" being tested on p. 353 requires the logical <TT>and</TT> to check that both of the criteria for its condition are True.

(<TT>condition) or last;</TT> # p. 352

(<TT>$answer ne 'y' and $answer ne 'n') or last;</TT> # p. 353