Greetings!

[EMAIL PROTECTED] (Mark Carmichael) writes:

> A single datapoint for "head" hecklers:
> 
>     [554] mxc@suse61: time ypcat hosts | wc -l
>       18259
> 
>     real    0m11.435s
>     user    0m0.340s
>     sys     0m0.050s
>     [555] mxc@suse61: time ypcat hosts | head -1 |  wc -l
>           1
> 
>     real    0m0.176s
>     user    0m0.050s
>     sys     0m0.010s
>     [556] mxc@suse61: ypwhich 
>     yphost
>     [557] mxc@suse61: ping -c 4 yphost
>     PING yphost (153.32.2.254): 56 data bytes
>     64 bytes from 153.32.2.254: icmp_seq=0 ttl=254 time=1.332 ms
>     64 bytes from 153.32.2.254: icmp_seq=1 ttl=254 time=1.473 ms
>     64 bytes from 153.32.2.254: icmp_seq=2 ttl=254 time=1.487 ms
>     64 bytes from 153.32.2.254: icmp_seq=3 ttl=254 time=2.837 ms
>     --- yphost ping statistics ---
>     4 packets transmitted, 4 packets received, 0% packet loss
>     round-trip min/avg/max = 1.332/1.782/2.837 ms
> 
> Seems worthwhile give the "wc -l" approach; I'd probably try
> 

Thanks for this!

>     if ypwhich -m $map 2>&1 >/dev/null; then
> 
> myself, but I don't know enough to be confident that there aren't lots of
> empty maps being served in the world.  I also don't know whether the exit
> status of 'ypwhich' can be trusted across likely implementations/versions.

I rather like this too, but I thought it best to stray as little as
possible from Peter's existing script, which uses ypcat on auto.master
piped into wc -l already.  Relying on fewer working parts.

> So, keeping with the check-ypcat-stdout approach: 
> 
>     if ypcat $map 2>/dev/null | read dummy; then
> 
> I'm a little more confident that that will work in likely Bourne shell
> variants.
> 

Does this read force an early return like the head?  Fine with me, if
everyone else agrees.

> 
> --
> Mark Carmichael


Take care,


-- 
Camm Maguire                                            [EMAIL PROTECTED]
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

Reply via email to