From owner-freebsd-questions Thu Jun 28 18:45: 5 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gilmore.nas.nasa.gov (gilmore.nas.nasa.gov [129.99.32.17]) by hub.freebsd.org (Postfix) with ESMTP id 286A337B406 for ; Thu, 28 Jun 2001 18:45:01 -0700 (PDT) (envelope-from tweten@nas.nasa.gov) Received: from gilmore.nas.nasa.gov (IDENT:f3sJx32nzjX40dQP2oqs7NGK8EhtWv88@localhost.nas.nasa.gov [127.0.0.1]) by gilmore.nas.nasa.gov (8.11.4/8.11.4) with ESMTP id f5T1itu01729 for ; Thu, 28 Jun 2001 18:44:55 -0700 (PDT) (envelope-from tweten@nas.nasa.gov) Message-Id: <200106290144.f5T1itu01729@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: freebsd-questions@freebsd.org Subject: Bourne Shell Syntax Wierdness From: Dave Tweten Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 28 Jun 2001 18:44:54 -0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The sh man page says that the two operators "||" and "&&" have the same precedence. It also says that a || b means "execute b if a terminates abnormally" and a && b means "execute b if a terminates normally." So I don't understand why true || true && echo Oops! prints "Oops!" This is apparently not a bug in FreeBSD sh, because IRIX, IRIX64, and SunOS Bourne/Korn shells work the same way, but it certainly runs counter to my ability to read English and the contents of the man page. Incidently, true || { true && echo Oops! } prints nothing -- which I would have expected with or without the "{}". Can anybody explain this? Can that explanation go into the sh man page? Thank you for any help you can provide -- from someone who expects to see a large, hurried, white rabbit at any minute now. -- 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-questions" in the body of the message