I'm trying to convert a script that was using Net::Telnet to now use Net::SSH2 but there are some differences in the commands that I'd like some advice on.
Here is an example that I have from the script. The first thing that doesnt work is "print" but there may be more.In this case $t is the Net::SSH2 connection. Can I reuse my code in a reasonable way or do I need to significantly redo this?$t->connect($jump_host); $t->auth_keyboard($jump_user, $jump_pass); $t->print("telnet $host"); } else { (undef, $host) = split /\s+/, $opte; $type = 'opte'; $t->open($host); } $t->waitfor('/:/'); $t->print($z{$type}{'user'}); $t->waitfor('/:/'); $t->cmd($z{$type}{'pass'}); $t->print('enable'); $t->waitfor('/:/'); $t->cmd($z{$type}{'sudo'}); $t->cmd('terminal length 0'); $t->cmd('terminal width 512'); $t->prompt('/[\$#] *$/');
In reply to Changing a script from Net::Telnet to Net::SSH2 by jtzako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |