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

add checking

[ Edited ]

deleted

Please use plain text.
Frequent Advisor
RJHall
Posts: 28
Registered: ‎05-30-2013
Message 2 of 3 (269 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.

Please use plain text.
Frequent Advisor
RJHall
Posts: 28
Registered: ‎05-30-2013
Message 3 of 3 (233 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?

Please use plain text.
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