Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jul 2009 18:39:35 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-chat@FreeBSD.ORG
Subject:   Re: Bourne shell short-circuit operators improperly documented
Message-ID:  <200907181639.n6IGdZxG015652@lurza.secnetix.de>
In-Reply-To: <200907172257.QAA15292@lariat.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907181639.n6IGdZxG015652>