Be Gomes wrote:
> 
> I am familiar with ps, this is how I am currently getting the process ID:
> 
> #!/usr/bin/perl -w
> use strict;
> my $pid = `ps -axo pid,ucomm |grep proxyd|cut -f 1 -d \"p\"`;
> 
> But I was wondering if anyone new another means of doing so.


If you have the pgrep command:

my @pids = `pgrep proxyd` =~ /\d+/g;


If your ps command supports the -C switch:

my @pids = `ps -C proxyd -o pid` =~ /\d+/g;


Using your current ps command:

my @pids = map /(\d+)\s+proxyd/, `ps -axo pid,ucomm`;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to