From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6162 invoked from network); 21 Jun 1997 16:39:44 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 21 Jun 1997 16:39:44 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id MAA21590; Sat, 21 Jun 1997 12:33:21 -0400 (EDT) Resent-Date: Sat, 21 Jun 1997 12:33:21 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199706211637.MAA00840@hzoli.home> Subject: Re: kill and pid files In-Reply-To: <199706211508.LAA08120@kira.peak.org> from "Timothy J. Luoma" at "Jun 21, 97 11:07:53 am" To: luomat@peak.org Date: Sat, 21 Jun 1997 12:37:12 -0400 (EDT) Cc: zsh-workers@math.gatech.edu (Zsh hacking and development) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"gwKyH2.0.EH5.H90hp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3274 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Timothy J. Luoma wrote: > Zoltan Hidvegi wrote in [...] > > Oh, this is a really overcomplicated solution for a simple problem. How > > about this: > > > > pid () { > > local i > > for i > > do > > ps acx | sed -n "s/ *\([0-9]*\) .* $i *\$/\1/p" > > done > > } > > Yes but what if there is more than one process by that name? > > I usually want to kill them all. This just kills one of them, whereas my > solution kills them all (that's what the 'tr' part is for).... however, it [...] > it also takes multiple arguments, in case you need to kill several things at once Did you try my script? kill -TERM `pid foo bar baz` will kill all foo, bar, baz named processes. And of course it can be improved, since sed is not necessary: pid () { setopt localoptions extendedglob local i for i do echo "${(M)${(M)${(f)$(ps acx)}:%* $i #}## #<->}" done } -- End of PGP signed section, PGP failed! Where can I find your PGP key? I tried finger -l, your web page and the key servers with no luck. Zoltan