nc tool different on different dists - seriously?

Christopher Rutter christopherrutter-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Oct 8 23:08:54 EDT 2010


Will this work on both distros:
(echo stats ; echo quit ) | nc localhost 11211

-Chris

On Fri, Oct 8, 2010 at 5:42 PM, Derek Martin <invalid-yPs96gJSFQo51KKgMmcfiw at public.gmane.org> wrote:

> On Fri, Oct 08, 2010 at 05:14:08PM -0400, theBlueSage wrote:
> > After 'man'ing the tool on both machines it appears the CentOS version
> > truly does not have the '-q' option, and that the Ubuntu version really
> > needs it.
> >
> > How is it possible that such a nice tool can get soooo messed up? Anyone
> > know a way around this?
>
> There are probably any number of approaches.  For example, I don't
> believe CentOS has /etc/lsb-release, but Ubuntu does... so you can do
> something like this:
>
>  # Figure out what to run
>  nc_option=""
>  if [ -f /etc/lsb-release ]; then
>      nc_option="-q1"
>  fi
>  nc_command="nc $nc_option localhost 11211"
>
>  # Now run it
>  echo "stats" | $nc_command
>
> A better approach would be to test netcat directly...  You could set
> up a routine that runs a netcat command with the -q option, and
> captures the stderr, and do the right thing based on that...
>
> --
> Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
> -=-=-=-=-
> This message is posted from an invalid address.  Replying to it will result
> in
> undeliverable mail due to spam prevention.  Sorry for the inconvenience.
>
>
> _______________________________________________
> Discuss mailing list
> Discuss-mNDKBlG2WHs at public.gmane.org
> http://lists.blu.org/mailman/listinfo/discuss
>
>





More information about the Discuss mailing list