Grep and ps, exclude grep itself

By neokrates, written on June 22, 2010

bash   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • Which Selenium configurations do you use to test your web front end?

    • We use other tool (80%, 12 Votes)
    • Selenium Grid (13%, 2 Votes)
    • Selenium Grids under CI (like Hudson or TeamCity) (7%, 1 Votes)
    • Single Selenium (0%, 0 Votes)
    • Many Selenium grids on one Server (0%, 0 Votes)
    • Other config (0%, 0 Votes)

    Total Voters: 15

    Vote

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:

If you write a shell script, you sometimes wish to rely on the process running or not running. If you just combine grep and ps to detect that some process is running, you will always get ’some’ output.
The grep itself, if nothing else. Use -v- option to reverse criteria (show all but nothing what is ‘grep’):

ps -ef|grep firefox|grep -v grep
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 2 votes)
1 votes 'YES'  1 votes 'NO'
TAGS
No tags for this post.
RELATED
Pages
Posts
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply