From owner-freebsd-stable Sat May 27 9:16:46 2000 Delivered-To: freebsd-stable@freebsd.org Received: from moek.pir.net (moek.pir.net [209.192.237.190]) by hub.freebsd.org (Postfix) with ESMTP id 1A94C37B77B for ; Sat, 27 May 2000 09:16:43 -0700 (PDT) (envelope-from pir@pir.net) Received: from pir by moek.pir.net with local (Exim) id 12vjGJ-0004pO-00 for stable@FreeBSD.ORG; Sat, 27 May 2000 12:16:31 -0400 Date: Sat, 27 May 2000 12:16:30 -0400 From: Peter Radcliffe To: stable@FreeBSD.ORG Subject: Re: killall question Message-ID: <20000527121630.A18184@pir.net> Reply-To: freebsd-stable@freebsd.org Mail-Followup-To: stable@FreeBSD.ORG References: <200005271258.IAA29766@thehousleys.net> <20000527093625.A1557@nc.rr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000527093625.A1557@nc.rr.com>; from aa8vb@nc.rr.com on Sat, May 27, 2000 at 09:36:25AM -0400 X-fish: < X-Copy-On-Listmail: Please do NOT Cc: me on list mail. Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Randall Hopper probably said: > Here's the shell script I settled on to override the default > /usr/bin/killall: > > ps -x | grep "$1" | egrep -v "grep|$0" | awk '{print $1;}' Ewwww. Pet peeve #24; if you're piping grep to awk, you shouldn't be. if you're piping grep to grep to awk, you did too much crack this morning. ps -x | awk '/'$0'/ { system("kill " $1) }' When I want to kill something specific I usually check the owner of the processes as well (it might not be mine, and I usually want to do this as root. ps -aux | awk '$1 == "owner" && $11 == "command" { system("kill " $2) }' awk is quite a nice little language, and includes every feature of grep you'd want to use. P. -- pir pir@pir.net pir@net.tufts.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message