[SunHELP] xargs ?

Nicholas Dronen sunhelp at sunhelp.org
Tue Jan 8 15:01:50 CST 2002


On Tue, Jan 08, 2002 at 09:08:32PM +0100, Jan Johansson wrote:
> On Tue, Jan 08, 2002 at 08:56:37AM -0700, Nicholas Dronen wrote:
> >$ kill $(ps -ef | grep '[b]aduser] | awk '{ print $2 }')
> 
> Useless use of grep?
> 
> kill $(ps -ef | awk ' /baduser/ { print $2 } ' )
> 
> It is not compleatly clean as someone editing a file called
> 'baduser' may also be killed. This is likely when you have a user
> called 'foo' as we do (stupid account system from above).
> 
> Maybe
> 
> kill $(ps -ef | awk ' "baduser" == $1 { print $2 }' )
> 
> is better.

Yes, yes.  I know how to use $1 and awk.  My point
was to show different ways to use kill and xargs.

Regards,

Nicholas Dronen



More information about the SunHELP mailing list