Bourne shell short-circuit operators improperly documented
Oliver Fromme
olli at lurza.secnetix.de
Sat Jul 18 16:39:53 UTC 2009
Actually I've never regarded "&&" and "||" (and also "|"
and "&") as operators, like real operators in a programming
language, but as command separators, much like ";", but
with special semantics.
Note that
foo && bar && baz
foo || bar || baz
is the same as
if foo; then if bar; then baz; fi; fi
if ! foo; then if ! bar; then baz; fi; fi
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"If you aim the gun at your foot and pull the trigger, it's
UNIX's job to ensure reliable delivery of the bullet to
where you aimed the gun (in this case, Mr. Foot)."
-- Terry Lambert, FreeBSD-hackers mailing list.
More information about the freebsd-chat
mailing list