On Fri, Sep 24, 2010 at 09:22:50AM +0100, Marc Herbert wrote:

> [...]
> For longer conditions brackets are easier to "parse"; the reader has no
> doubt where it ends.
> 
> By the way I wonder if this makes any difference to the actual parser.
> 
> On the other hand some people explain that long conditions are bad
> practice anyway, and that you should write:
> 
>      test x && test y || test z

which, on the other hand, people sometimes use as replacement for

   if test x; then test y; else test z; fi

although it behaves differently. In the former, test z is also
executed if test y fails.  It's even more unintuitive if you're
not using test but arbitrary commands:

test x && cmd1 || cmd2

(again: cmd2 is even executed if cmd1 fails)

Randal Schwartz once mentioned the idea of a "Dangerous Use Of And-Or" award :)

Reply via email to