Happy Almost New Year!

I want to run a command inside a script.  From the shell, here's the command:

% ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk '{print $2}'
19460

What is returned is the pid of the process being grep'd.

But, when I put this into a test script, 

my $pid = `ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk 
'{print $2}'`;
print "\$pid is: $pid \n";

here's what I'm seeing ,

$pid is:      root 19460     1  0   Dec 18 ?        0:08 /usr/lib/sendmail -bd -q15m

--

It seems to be only going as far as dropping off the grep, and not doing the
awk '{print $2}'.   I've tried this with the system() call, with the same
results.  

What am I missing?   :-(

deb



-- 
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