List Archive: gentoo-amd64
Note: Due to technical difficulties, the Archives are currently not up to date.
provides an alternative service for most mailing lists.c.f. bug 424647
Maciej Kazulak wrote:
> That's how bash evaluates logic expressions. There's even a fancy word
> for it i think. Point is it will execute commands only to the point
> where it can determine the logic result.
The fancy word for it would probably be short circuit evaluation:
When placing code in a boolean expression it is critical to understand
whether the boolean operator will be evaluated in a short-circuit
fashion in any language.
I'm not aware of any language that works this way, but potentially you
could even have out-of-order boolean evaluation (ie echo "hello" &&
false does nothing) in a very well optimized language.
Using && in this way is technically a bit of a hack - the && operator
was intended to evaluate a boolean expression and not as a replacement
for "if". That doesn't stop 99.9999999% of shell scripters from using
it, however. It is less of a hack than writing the equivalent of 30
lines of code inside a for(<gobs of code> ; <gobs of code> ; <gobs of
code>); statement in C. :)