[SunHELP] xargs ?

Jan Johansson sunhelp at sunhelp.org
Tue Jan 8 14:08:32 CST 2002


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.



More information about the SunHELP mailing list