I am trying to automate telnet to a Linux box which doesn't require any authentication through Net::Telnet Perl module. Here is a test script:
use strict;
use Net::Telnet;
my $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die',
host=> '10.104.20.200', port => 2004,
);
$telnet->print('ls');
my $output = $telnet->waitfor('/\$ $/i');
print $output;
When I execute this script, I get the below error,
pattern match timed-out at telnetPerl.pl line 7.
As you could see, I am matching for any characters in waitfor
. But I doubt whether the telnet connectivity happened in the first place.