From owner-freebsd-doc Thu Jun 28 21:42:46 2001 Delivered-To: freebsd-doc@freebsd.org Received: from gilmore.nas.nasa.gov (gilmore.nas.nasa.gov [129.99.32.17]) by hub.freebsd.org (Postfix) with ESMTP id 5F8BA37B40B for ; Thu, 28 Jun 2001 21:42:43 -0700 (PDT) (envelope-from tweten@nas.nasa.gov) Received: from gilmore.nas.nasa.gov (IDENT:RZVF0DKir8up3m5vnjOhgV6WeiiP66Da@localhost.nas.nasa.gov [127.0.0.1]) by gilmore.nas.nasa.gov (8.11.4/8.11.4) with ESMTP id f5T4gLu02151; Thu, 28 Jun 2001 21:42:29 -0700 (PDT) (envelope-from tweten@nas.nasa.gov) Message-Id: <200106290442.f5T4gLu02151@gilmore.nas.nasa.gov> X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 Reply-To: tweten@nas.nasa.gov To: Pete Fritchman Cc: freebsd-doc@freebsd.org Subject: Re: Fw: Re: Bourne Shell Syntax Wierdness From: Dave Tweten Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 28 Jun 2001 21:42:20 -0700 Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org petef@databits.net said: >you first take 'true || true' -- you end up with true. According to the man page, "||" is NOT "or". Instead it is an operator that causes the command to its right to be executed only if the simple command to its left fails. Therefore, 'true || true' means "continue without executing the rightmost "true". The (slightly dated) copy of POSIX.2 I have in my office actually calls the following an "OR List," but says command1 [ || command2 ] ... means: "First, command1 shall be executed. If its exit status is nonzero, command2 xhall be executed, and so on until a command has a zero exit status or there are no more commands left to execute." Similarly, it calls the following an "AND List," but says command1 [ && command2 ] ... means: "First, command1 shall be executed. If its exit status is zero, command2 shall be executed, and so on until a command has a nonzero exit status or there are no more commands left to execute. The comnmands shall be expanded only if they are executed." Curiously, POSIX says nothing about a list containing both operators. -- M/S 258-5 | 1024-bit PGP fingerprint: | tweten@nas.nasa.gov NASA Ames Research Center | 41 B0 89 0A 8F 94 6C 59 | (650) 604-4416 Moffett Field, CA 94035-1000 | 7C 80 10 20 25 C7 2F E6 | FAX: (650) 604-4377 We each earn what freedom of speech we defend for those who most offend us. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message