problem with shell script

Jonathan McKeown j.mckeown at ru.ac.za
Thu Jan 13 06:42:53 UTC 2011


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


More information about the freebsd-questions mailing list