Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!acorn!ixi!ixi!pd From: pd@ixi.uucp (Paul Davey) Newsgroups: comp.unix.wizards Subject: Re: How to find process name in c? Message-ID: Date: 17 Jul 90 12:15:30 GMT References: <570001@carter.BCASDL.BOEING.COM> Sender: paul@x.co.uk (Paul Davey) Organization: IXI Ltd. Lines: 28 In-Reply-To: lyn@carter.BCASDL.BOEING.COM's message of 13 Jul 90 14:57:36 GMT In article <570001@carter.BCASDL.BOEING.COM> lyn@carter.BCASDL.BOEING.COM ( Lyn Stewart ) writes: Has anyone got a method for finding out if a process is running short of "ps -ef | grep processname" in a pipe. There must be a better way from within a c program. Well, for interactive use I use csh aliases, they should be easy enough to move to (k)sh functions if you don't use csh. I've not needed to solve the problem strictly or within a program. This is what I use on sys5 machines, alias psg 'ps -ef | sed -n -e "/sed -n -e /d\\ /\!$/p\\ /TIME COMMAND/p"' Everything except the 'ps -ef' is ok on BSD. Change that to 'ps aux' 'psg pd' shows all processes containing the string pd. -- Regards, pd@x.co.uk IXI Limited Paul Davey pd@ixi.uucp 62-74 Burleigh St. ...!uunet!ixi!pd Cambridge U.K. "These are interesting times" +44 223 462 131 CB1 1OJ