Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: perl expect

by salva (Abbot)
on Sep 16, 2013 at 07:38 UTC ( #1054241=note: print w/ replies, xml ) Need Help??

in reply to perl expect

use Net::OpenSSH;

... my ($host, $user, $password, @cmds) = split ',', $line; my $ssh = Net::OpenSSH->new($host, user => $user, password => $passwor +d); if ($ssh->error) { print STDERR "Unable to log into remote host: ".$ssh->error; next; } print "HOST: $host\n\n" for my $cmd (@cmds) { my ($out, $err) = $ssh->capture2($cmd); print "CMD: $cmd\nRC: $?\nSTDOUT:\n$out\nSTDERR:\n$err\n\n\n"; }
Consider also using some CPAN module to parse the CSV files (i.e. Text::CSV). That way you will be able to handle files with quoted fields inside correctly.

Comment on Re: perl expect
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054241]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-07-29 05:48 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (260 votes), past polls