Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: kill and pid files
- X-seq: zsh-users 908
- From: Matt Welland <mwelland@xxxxxxxxxxxxxxxx>
- To: Users Zsh <zsh-users@xxxxxxxxxxxxxxx>
- Subject: Re: kill and pid files
- Date: Thu, 19 Jun 1997 05:19:36 -0700 (PDT)
- In-reply-to: <199706190642.CAA05741@xxxxxxxxxx>
On Linux the killall command does what I need (I am forever doing "killall
diald" - but thats another story - *sigh*). However the little snippet
below just went into my .zshrc - AIX killall doesn't take process names as
parameters.
See - if you watch this list long enough at least 80% of those little
"argh - I must get around to writing that" bits of code will get written
for you!
--Matt
On Thu, 19 Jun 1997, Zoltan Hidvegi wrote:
> > well, I don't have the file part, but I use this
> >
> > pid () {
> >
> > for i in $*
> > do
> > echo `/bin/ps -auxwww | grep -v grep |
> > grep -w $i | awk '{print $2}' | tr -s '\012' ' '`
> >
> > done
> >
> > }
>
> 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
> }
>
> Under Linux, you can even do that without ps or sed:
>
> pid2 () {
> local i
> for i in /proc/<->/stat
> do
> [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t
> done
> }
>
> Zoltan
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author