On Thu, 2004-05-13 at 07:03, Michael Terry wrote:
> Hi,
> 
> I've got this shell script:
> 
> #!/bin/sh
> ps axc|awk "{if (\$5==\"$1\") print \$1}";
> 
> ... which gets a PID if you feed it the process' name. Is there a way 
> to translate this into Perl using a standard Perl distribution? I mean, 
> without calling 'ps'; I've learned enough Perl now to be able to do 
> that, but I'd like to see if there's a cleaner way. I don't know, maybe 
> process names aren't something other operating systems have, so Perl 
> doesn't have anything for them--I'm on Mac OS X.
> 
> I checked everything that was indexed in Programming Perl that looked 
> likely, but obviously I didn't find anything.


I done think perl will behave  any differently on MAC as compared to
*nix
just try $PID=$$;
that should work

( BTW even in shell $$ is the pid , no need to do any jugglery with ps )

Bye
Ram




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to