Bourne shell short-circuit operators improperly documented

Dag-Erling Smørgrav des at des.no
Sat Jul 18 17:23:05 UTC 2009


Adrian Wontroba <aw1 at stade.co.uk> writes:
> Perhaps the syntax could have been " and " / " or " (as in Perl's
> and / or statement qualifiers (something() or die "oops";), but it is
> far too late to change sh syntax. We have to live with it or use a
> different shell or language.

Pop quiz: what are the semantics of the follwing command line after your
proposed change:

echo I need a box and cat litter for my new kittens.

There is absolutely nothing surprising or illogical about the && and ||
command separators.

There is absolutely nothing surprising about "zero means success, non-
zero means failure" either - that's how most Unix system calls and many
standard C library functions work.

I'm sure we all have better things to do than argue about this non-
issue.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-chat mailing list