ash - exit code for a piped process
Alexander Kriegisch
Alexander at Kriegisch.name
Sat Aug 4 07:16:44 PDT 2007
> x=`((( foo 3>&- 4>&- ); echo $? >&3)| bar >&4 3>&- 4>&-) 3>&1` 4>&1
Thanks, Loïc. I will consider your solution if I ever have a case like
this again, but my current workaround is rather simple to read and uses
a text buffer for the first command's output. I can do this because I
know that foo's output has a limited size which can be easily handled in
memory. So I choose this way for the sake of readability:
output=$(foo)
result=$?
echo "$output" | bar
I know the solution is somewhat limited, but a feasibly workaround in my
special case. Yours is more refined and really uses pipes.
--
Alexander Kriegisch
More information about the busybox
mailing list