[SunHELP] xargs ?

DAUBIGNE Sebastien - BOR ( SDaubigne@bordeaux-bersol.sema.slb.com ) SDaubigne at bordeaux-bersol.sema.slb.com
Wed Jan 9 05:05:07 CST 2002


Useless use of awk ?

ps -u baduser -o pid

is asimplier way to return every baduser's process pids.

---
Sebastien DAUBIGNE
sebastien.daubigne at sema.fr <mailto:sebastien.daubigne at sema.fr>  - (+33)
(0)5.57.26.56.36
Sema Global Services - AFM/DW/Pessac

	-----Message d'origine-----
	De:	Jan Johansson [SMTP:janj-sunhelp at wenf.org]
	Date:	mardi 8 janvier 2002 21:09
	@:	sunhelp at sunhelp.org
	Objet:	Re: [SunHELP] xargs ?

	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.
	_______________________________________________
	SunHELP maillist  -  SunHELP at sunhelp.org
	http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list