Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

add checking

2ne1Abcd
Occasional Contributor

add checking

deleted

2 REPLIES
Highlighted
RJHall
Frequent Advisor

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.

RJHall
Frequent Advisor

Re: add checking

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?