Bug#267142: huh?
Colin Watson <cjwatson@debian.org> writes:
> (Take that as you will. Variants of both continue to exist in
> production systems, and I'm pretty sure that there are still current
> branches of Unix with the broken precedence of test's -a and -o
> primaries. On the other hand, to a Debian-only purist neither matters.)
I admit, I've never understood quite why the precedence is "broken"
here.
Perhaps I just use parentheses anyway with complex logical
expressions.
I find the shell syntax very broken, because it's weirdly right
associative, so I find using shell && and || freaky. And then using
parens is nasty, because they create subshells and slow things down.
All this means that I have always hated shell && and || syntax.
And, concomitantly, I like the test syntax, because it maps exactly to
my model of the logical connectives.
As a philosopher, I insist that there is no natural precedence between
AND and OR, because each equally distributes over the other. So an
expression like "p OR q AND r" is simply ambiguous. So I always use
parens.
Thomas
Reply to: