Date: Thu, 28 Jun 2001 18:44:54 -0700 From: Dave Tweten <tweten@nas.nasa.gov> To: freebsd-questions@freebsd.org Subject: Bourne Shell Syntax Wierdness Message-ID: <200106290144.f5T1itu01729@gilmore.nas.nasa.gov>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106290144.f5T1itu01729>
