Aha! You are right. Our server is Ubuntu, and the default nc is nc.openbsd after install nc.traditional, it supports echo "stat" | nc localhost 2181now
Thanks so much! ps. just for curious, doesn't nc.openbsd support pipeline? that is weird. On Tue, Feb 18, 2014 at 6:34 PM, Tomas Nunez <[email protected]> wrote: > Most probably you are using the wrong "nc" command. > > Not kidding :P there are two different "nc" packages, and the syntax is > different betweem then. In debian-like distros they are netcat-openbsd and > netcat-traditional, but I ran into the same problems with netcat in CentOS > (I can't remember the name of the packages, sorry) until I realized I was > using it wrong. > > > On Tue, Feb 18, 2014 at 11:21 AM, 刘明敏 <[email protected]> wrote: > > > I try to get zookeeper stat from shell by using nc, > > > > This works: call nc localhost 2181 first, then type in: *stat*. > > > > while echo "stat" | nc localhost 2181 returns Nothing. > > > > Any idea why it doesn't work? > > > > Thanks ;-) > > > > -- > > Best Regards > > > > ---------------------- > > 刘明敏 | mmLiu > > > > -- > > > -- > > > > -- Best Regards ---------------------- 刘明敏 | mmLiu
