[BusyBox] ash and grep with busybox 1.00

Rob Landley rob at landley.net
Tue Feb 22 07:05:41 UTC 2005


On Monday 21 February 2005 11:07 am, Peter Kjellerstedt wrote:

> > It's pretty unpredictable :) I could use sed to return me
> > only one line, but I does fit to my needs.
>
> The reason you sometimes get 1 and sometimes 2, is probably
> due to whether grep has triggered on itself in the list of
> processes or not.

The way I've always worked around this is to split it into two commands:

TMPVAL=`ps ax`
echo "$TMPVAL" | grep rutabega

It's not a busybox problem, it's a standard race condition instantiating 
multiple processes in a pipeline while checking the process list...

Rob



More information about the busybox mailing list