use of 'testing' function from testsuite/testing.sh
Denys Vlasenko
vda.linux at googlemail.com
Fri May 2 23:49:18 PDT 2008
On Saturday 03 May 2008 01:39, Paul Smith wrote:
> 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!"
Or just echo exit code:
bash-3.2# echo FOO | { sleep 1; echo $?; read foo; echo $foo; }
0
FOO
bash-3.2# echo FOO | { cat >/dev/null; echo $?; read foo; echo $foo; }
0
bash-3.2#
--
vda
More information about the busybox
mailing list