Re: add checking (292 Views)
Reply
Occasional Contributor
2ne1Abcd
Posts: 7
Registered: ‎09-11-2013
Message 1 of 3 (347 Views)

add checking

[ Edited ]

deleted

Frequent Advisor
RJHall
Posts: 30
Registered: ‎05-30-2013
Message 2 of 3 (328 Views)

Re: add checking

One way to check the output of a system command is to run it in a Perl 'open' operation and filter on the output. For example:

 

my $fh;

my $cmd = "ls -1 /tmp";

if ( open( $fh, "$cmd |" ) ) {

  while( $fh ) {

    my $line = $_;

    # Process the $line content here...

  }

 

  close( $fh);

}

 

There's plenty of examples of this sort of operation on the web. But I'd suggest learning a little more about perl before you proceed.

Frequent Advisor
RJHall
Posts: 30
Registered: ‎05-30-2013
Message 3 of 3 (292 Views)

Re: add checking

[ Edited ]

I'm having some difficulty understanding you. What do you mean by "the UNIX command"? Do you want to pass an arbitrary command to the subroutine and have it executed?

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.