zsh-users
 help / color / mirror / code / Atom feed
From: Matt Welland <mwelland@ichips.intel.com>
To: Users Zsh <zsh-users@math.gatech.edu>
Subject: Re: kill and pid files
Date: Thu, 19 Jun 1997 05:19:36 -0700 (PDT)	[thread overview]
Message-ID: <Pine.A32.3.93.970619045641.39972D-100000@pdx201> (raw)
In-Reply-To: <199706190642.CAA05741@hzoli.home>


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
> 


  reply	other threads:[~1997-06-19 12:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-18  7:25 Robert Stone
1997-06-18 20:16 ` Timothy J Luoma
1997-06-19  6:42   ` Zoltan Hidvegi
1997-06-19 12:19     ` Matt Welland [this message]
1997-06-21 15:07     ` Timothy J. Luoma
1997-06-19 10:53   ` Vardhan Varma
1997-06-18 13:05 Wez Furlong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.A32.3.93.970619045641.39972D-100000@pdx201 \
    --to=mwelland@ichips.intel.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).