Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: perl expect

by salva (Monsignor)
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 browsing the Monastery: (9)
As of 2014-09-30 11:06 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (363 votes), past polls