[BusyBox] ash and grep with busybox 1.00

Buttchereit, Axel (XL) XL at XLsigned.net
Mon Feb 21 15:52:54 UTC 2005


ps aux | grep "expression" | grep -c -v "grep"

:-) Axel


Florian Fainelli wrote:
> Hi !
> 
> I would like grep to return me only one line, it is possible to do that ? eg :
> 
>  ps aux | grep -c "/usr/sbin/telnetd"
> 1
>  ps aux | grep -c "/usr/sbin/telnetd"
> 2
> It's pretty unpredictable :) I could use sed to return me only one line, but I 
> does fit to my needs.
> 
> Then, why does ash gives me an error when attempting to do that :
> 
> if [ `ps aux | grep -c telnet` >= "1" ]; then
> 	tel="on"
> else
> 	tel="off"
> fi
> 
> ash does not like >= operator ? Or am I wrong with the ash operators ?
> 
> Thanks for your answers.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list