Hi!
> for example:
>     $ finger @xxxx || echo "test fail"
>     finger: unknown host: xxxx
>     getaddrinfo: No address associated with hostname
>     test fail

Hmm, at my computers (SUSE, Gentoo) it works as:

$ finger @xxxx || echo "test fail"
finger: unknown host: xxxx

Are you sure that finger returns nonzero? From what package and what
version does your finger come from?

Btw what is wrong at the code bellow is the redirection, which does not
work, the >/dev/null should be before the 2>&1. Even if your finger
really returns nonzero the code bellow is quite cryptic as it looks like
it redirects all output from the finger into the /dev/null but it really
just redirects stderr into stdout which goes to the grep...

> ---
>  testcases/network/tcp_cmds/finger/finger01 |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/network/tcp_cmds/finger/finger01 
> b/testcases/network/tcp_cmds/finger/finger01
> index 6a72c8f..a5206be 100755
> --- a/testcases/network/tcp_cmds/finger/finger01
> +++ b/testcases/network/tcp_cmds/finger/finger01
> @@ -116,8 +116,8 @@ do_test2()
> 
>      tst_resm TINFO "finger -bad user "
>      finger $BADUSER 2>&1 1>/dev/null || end_testcase "finger $BADUSER"
> -    finger @$BADHOST 2>&1 1>/dev/null || end_testcase "finger @$BADHOST"
> -    if ! finger $BADUSER@$BADHOST 2>&1 1>/dev/null; then
> +    finger @$BADHOST 2>&1 1>/dev/null | grep "finger: unknown host" || 
> end_testcase "finger @$BADHOST"
> +    if ! finger $BADUSER@$BADHOST 2>&1 1>/dev/null | grep "finger: unknown 
> host"; then
>          end_testcase "finger $BADUSER@$BADHOST"
>      fi
>  }

-- 
Cyril Hrubis
chru...@suse.cz

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to