Bug/misfeature in 4bsd /bin/sh

Paul Eggert eggert at sea.sm.unisys.com
Sun Nov 20 10:26:02 AEST 1988


Mark Bartelt complained that in Berkeley Unix the shell command (X|Y|Z)
nondeterministically yields the exit status of X, Y, or Z, whereas in AT&T Unix
(X|Y|Z) always yields the exit status of Z.  He wrote that the Berkeley Unix
folks had removed words from the man page, and asked why Berkeley "changed the
semantics of the shell in this somewhat rude way?"

I'm afraid Bartelt had his history backward.  Older Bourne shells have the
nondeterministic semantics; newer ones from AT&T are deterministic.  AT&T made
the change, not Berkeley.

Unfortunately, under either semantics, you can't tell whether all the commands
in a pipeline succeed.  Instead, (X|Y|Z) should yield the logical OR of the
exit statuses of X, Y, and Z.  Why didn't AT&T see this?



More information about the Comp.unix.wizards mailing list