From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: luomat@peak.org
Cc: rstone@accesscom.com, zsh-users@math.gatech.edu
Subject: Re: kill and pid files
Date: Thu, 19 Jun 1997 02:42:34 -0400 (EDT) [thread overview]
Message-ID: <199706190642.CAA05741@hzoli.home> (raw)
In-Reply-To: <Pine.NXT.3.96.970618161237.19016A-100000@cc344191-a.ewndsr1.nj.home.com> from Timothy J Luoma at "Jun 18, 97 04:16:13 pm"
> 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
next prev parent reply other threads:[~1997-06-19 6:49 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 [this message]
1997-06-19 12:19 ` Matt Welland
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=199706190642.CAA05741@hzoli.home \
--to=hzoli@ny.frontiercomm.net \
--cc=luomat@peak.org \
--cc=rstone@accesscom.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).