Binand Sethumadhavan wrote:
On Wed, 22 Dec 2004 11:22:15 +0530, Raj Mathur <[EMAIL PROTECTED]> wrote:

Another way of achieving the same effect is:

ps ax | fgrep cron | fgrep -v fgrep


Heh. This brings up one of my favourite Unix interview questions.

How do you do the same thing for a (possibly long running) grep
command? That is, in the example above, instead of cron, how do you
get exactly one line of output if the process in question were a grep?


[/home/soumen] $ grep asdfasdf & [1] 2974 [/home/soumen] $

[1]+  Stopped                 grep asdfasdf
[/home/soumen] $ ps -eaf |grep grep
soumen    2974  2643  0 22:48 pts/2    00:00:00 grep asdfasdf
soumen    2976  2643  0 22:48 pts/2    00:00:00 grep grep
[/home/soumen] $ ps -eaf |grep grep |grep -v "grep grep"
soumen    2974  2643  0 22:48 pts/2    00:00:00 grep asdfasdf
[/home/soumen] $

Is this the right approach?

Binand

--
Soumen


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
linux-india-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to