Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Dec 2005 09:21:23 -0600
From:      Eric Schuele <e.schuele@computer.org>
To:        Sergey Zaharchenko <doublef-ctm@yandex.ru>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: grep'ping the ps output....
Message-ID:  <439EE6F3.2080202@computer.org>
In-Reply-To: <20051213145718.GB30661@shark.localdomain>
References:  <439D9FA3.7030603@computer.org> <20051213145718.GB30661@shark.localdomain>

next in thread | previous in thread | raw e-mail | index | archive | help
Sergey Zaharchenko wrote:
> Hello Eric!
> 
> Mon, Dec 12, 2005 at 10:04:51AM -0600 you wrote:
> 
> 
>>I was wondering if someone could explain why it is sometimes there and 
>>not other times.
> 
> 
> Sometimes the ps process manages to catch the system state when grep has
> not been started yet by the shell. Sometimes it doesn't.
> 
> 
>>And how I should correctly go about detecting if the 
>>process is running before I perform my action.
> 
> 
> You may use the -c flag of ps:
> 
>      -c      Change the ``command'' column output to just contain the exe-
>              cutable name, rather than the full command line.
> 
> Like:
> 
> df@shark:~> ps axc |grep init
>     1  ??  ILs    0:00,00 init
> 

Yes... Of course.  That's the solution I'm looking for.

Good thing I read over that man page before I posted my msg... Or I 
could've embarrassed myself.  :}

Thanks.

-- 
Regards,
Eric



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?439EE6F3.2080202>