in reply to Re^2: How do I get expect.pm to ignore special characters?
in thread How do I get expect.pm to ignore special characters?
Well you could return values:
$ssh->expect(5, '#') or return "ERROR"You can also lower the amount of timeout, 60 is ok while you make the initial handshake connection, but you must have a WAN if you need to wait 60 seconds for the other prompt. Any way; and at the end of the subroutine:
return "OK"; }
Then in your main loop, you pick that value up:
for my $server (@servers) { # do your thing with $server $rc = change_password($server); if($rc eq "ERROR"){ die "PANIC for $server"} }
|
|---|