2010-12-27, 13:14(+01), <[email protected]>:
> Hello
>
> More information on that topic :
>
> false ; false | echo $? stills prints 0.
> false ; (false) | echo $? prints 1
>
> So.. ? $? in the right side of a pipe is randomly the exit
> status of the left side depending of the way you write it ?
> Doesn’t sound sane.
That's not the exit status of the left side. It couldn't be as
both sides of the pipe are started at the same time and run
concurrently.
> Doesn’t that break POSIX anyway ?
I suppose it does. I can't see any reason why the above
shouldn't print 1 in any case.
> I think it should be fixed.
Me too.
Note that $PIPESTATUS doesn't seem to be affected by that bug.
$ bash -c '(exit 2) | (exit 3) ; false | echo $?, "${pipestat...@]}"'
0, 2 3
--
Stephane