Help with Perl script

Anth Courtney anth.courtney at distra.com
Tue Mar 24 22:14:14 UTC 2009


Dave,

On Tue, 24 Mar 2009, Dave Martini wrote:

> I'd like to run a command called metastat and have it search its output
> for the word Ok but what I have so far doesn't work. Anyone have any
> suggestions?
> 
> #!/bin/perl
> $target = "Ok";
> open(INPUT, "<'metastat'");

Change this line to

open(INPUT, "metastat|");

> while (<INPUT>) {
> if (/$target/) {
>                 print  "Found $target\n";
> }
> }
> close(INPUT);

cheers,
Anth




More information about the redhat-list mailing list