2006/12/20, Dukelow, Don <[EMAIL PROTECTED]>:
I'm going into a "while" loop with a list of servers and need to execute a
remote command and bring back the output. Doing a "qx/remsh <server name>
<my script/;" doesn't bring back the output. I'm sure this can be done
but
how?
Don Dukelow
What about pipe'ing the output of your program to Perl? Check the (untested)
code below.
<code>
foreach my $host (@hosts) {
open my $remsh, "remsh $host < script |" or die $!;
my $output;
{
local $/;
$output = <$remsh>;
}
print "$output";
close $remsh or warn $!;
}
</code>
You also has the option to use a secure shell instead, and then
Net::SSH::Perl[1] comes to rescue you.
[1] http://search.cpan.org/~dbrobins/Net-SSH-Perl-1.30/lib/Net/SSH/Perl.pm
Hope this helps!
--
Igor Sutton Lopes <[EMAIL PROTECTED]>