Happy Almost New Year!

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

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

---- snip ----

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

---- snip ----

And, here's the output:

$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 (grep -v), 
and never executing the awk '{print $2}'.   I've tried this with
the system() call, with the same results.

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