use of 'testing' function from testsuite/testing.sh

Paul Smith paul at mad-scientist.us
Fri May 2 23:39:46 UTC 2008


On Fri, 2008-05-02 at 19:29 -0400, Paul Smith wrote:
> echo FOO | { some command; read foo; echo $foo; }
> 
> If that prints FOO you're OK; otherwise "some command" used it up.

Sorry for all the mail.

The big problem with this is you lose the exit code for "some command".
Maybe this instead?

        echo FOO 2>/dev/null | { some command && read foo; } \
        	|| echo "Failed!"

The "read" operation will fail if it can't read anything, which means
that if either "some command" OR the read fails, the pipeline will fail.



More information about the busybox mailing list