Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2011 08:42:45 +0200
From:      Jonathan McKeown <j.mckeown@ru.ac.za>
To:        freebsd-questions@freebsd.org
Subject:   Re: problem with shell script
Message-ID:  <201101130842.45695.j.mckeown@ru.ac.za>
In-Reply-To: <C756456F-3B1C-4210-BA40-3A064384A038@panix.com>
References:  <4D2DB449.6070901@esiee.fr> <AANLkTinkSOUm84RamXn8qToxb5YQG%2BH6VwOtKZJVy7nN@mail.gmail.com> <C756456F-3B1C-4210-BA40-3A064384A038@panix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 12 January 2011 17:58:33 David Scheidt wrote:
>
> ps ax | grep [s]lapd | wc -l
>
> The [] creates a one-character class that doesn't match the regex.  Easier
> to type and grep should be a bit faster. 

And you can save another process by using

ps ax | grep -c '[s]lapd'

Although as others have pointed out, you can also use pgrep.

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101130842.45695.j.mckeown>