I run script in Linux environment. I am trying to connect to a box and execute commands, all of sudden the handle gets close/not able to send any command on that expect channel and give error.
Please find sample code snippet:
#!/usr/bin/perl
use strict;
use Expect;
my $session = new Expect;
$session->spawn("/volume/labtools/bin/nicetelnet -KE $my_ip");
$session->expect(90, -re, "login:");
print $session "regress\r";
$session->expect(90, -re, "Password:");
print $session "MaRtInI\r";
$session->expect(90, -re, ".*");
print $session "pwd\r";
$session->expect(90, -re, ".*");
$session->close();
<\p>
Error:
Get below error, when script tries to print "pwd\r" cmmand on the expect handle.
ERROR: No such file or directory
<\p>
Thanks in advance