Saifuddin Bohra/Hss wrote:
>
> Hi,
Hello,
> I am new to Perl. I have a follpwing shell script
>
> if [ -n "`netstat -na|grep LISTEN |grep 1099`" ];
> then
> exit 0
> else
> exit 1
> fi
>
> I need the perl script for the same job.
> and how to use this in another perl program
> Any pointer ??
#!/usr/bin/perl
use warnings;
use strict;
open PIPE, 'netstat -na |' or die "Cannot open pipe from netstat: $!";
while ( <PIPE> ) {
exit 0 if /LISTEN/ and /1099/;
}
exit 1;
__END__
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]