Bug/misfeature in 4bsd /bin/sh
Bjorn Engsig
bengsig at orcenl.uucp
Mon Nov 21 19:02:58 AEST 1988
In article <5538 at sdcrdcf.sm.unisys.com>, eggert at sea.sm.unisys.com (Paul Eggert) writes:
> Mark Bartelt complained that in Berkeley Unix the shell command (X|Y|Z)
...
>
> 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?
Oh no! We have the logical OR and AND as || and &&, and they are of course
not pipe-symbols (they combine pipelines).
Do you mean that (x|y|z) should never call z if y returned non-zero?
Or should the all be called and the return codes simply logical OR'ed?
In this case, what would the meaning be of, say 1|2|3 == 3, or 1|0|3 == 3?
The SysV behaviour is the only acceptable one.
--
Bjorn Engsig, ORACLE Europe \ / "Hofstaedter's Law: It always takes
..!uunet!mcvax!orcenl!bengsig X longer than you expect, even if you
phone: +31 21 59 56 411 / \ take into account Hofstaedter's Law"
More information about the Comp.unix.wizards
mailing list