ps ax | grep exim | grep -v grep ;)
On Mon, 30 Oct 2000, Phil Pennock wrote:
> On 2000-10-27 at 17:11 -0400, George Schlossnagle gifted us with:
> > $count = `ps auxw| grep -v grep |grep -c -- "exim -q";
>
> That's missing a closing backtick (`).
>
> Handy grep trick:
>
> $count = `ps axuw | grep -c -- "[e]xim -q"`;
>
> Generally, the [x] trick is very useful in greps where you want to avoid
> getting the grep itself. [e] matches the one 'e', and nothing else, so
> the 'exim's all match; but because the grep itself doesn't have "ex" in
> it, it doesn't match.
>
> I _think_ that I learnt that one from Aeleen Frisch's Essential System
> Administration (1st Ed, though now in 2nd Ed). If you want to improve
> your general Unix sysadmin skills, I can't commend this book highly
> enough. 2nd Ed includes lots of Linux stuff too.
>
--