Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: kill and pid files
- X-seq: zsh-workers 3274
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxxxxxx>
- To: luomat@xxxxxxxx
- Subject: Re: kill and pid files
- Date: Sat, 21 Jun 1997 12:37:12 -0400 (EDT)
- Cc: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- In-reply-to: <199706211508.LAA08120@xxxxxxxxxxxxx> from "Timothy J. Luoma" at "Jun 21, 97 11:07:53 am"
Timothy J. Luoma wrote:
> Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author