Hello !!!
I forgot to attach the result from the suggestion using the $session->exp_internal(1);
root@F101-8:~# cat test.pl
#!/usr/bin/perl5.8.4
use Expect;
my $timeout = 5;
$session = new Expect;
$session->exp_internal(1);
#$session->debug(3);
$session->spawn("ssh 666.666.666.666 -l root\r");
$session->expect($timeout, "password:");
$session->send("wibbilwobble\r");
$session->expect($timeout, "F101");
$session->send("\r");
$session->expect($timeout, "F101");
$session->send("exit\r");
$session->expect($timeout, "F101");
root@F101-8:~#
root@F101-8:~#
root@F101-8:~# perl test.pl
'pawned 'ssh 666.666.666.666 -l root
spawn id(3)
Pid: 20277
Tty: /dev/pts/2
Expect::spawn('Expect=GLOB(0x1028abbc)', 'ssh 666.666.666.666
+-l root\x{d}') called at test.pl line 9
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x1028abbc)', 5, 'password:') call
+ed at test.pl line 10
spawn id(3): list of patterns:
#1: -ex `password:'
spawn id(3): Does `'
match:
pattern #1: -ex `password:'? No.
Sending 'wibblewobble\r' to spawn id(3)
Expect::print('Expect=GLOB(0x1028abbc)', 'wibblewobble\x{d}')
+called at test.pl line 11
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x1028abbc)', 5, 'F101') called at
+ test.pl line 12
spawn id(3): list of patterns:
#1: -ex `F101'
spawn id(3): Does `'
match:
pattern #1: -ex `F101'? No.
Sending '\r' to spawn id(3)
Expect::print('Expect=GLOB(0x1028abbc)', '\x{d}') called at te
+st.pl line 13
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x1028abbc)', 5, 'F101') called at
+ test.pl line 14
spawn id(3): list of patterns:
#1: -ex `F101'
spawn id(3): Does `'
match:
pattern #1: -ex `F101'? No.
Sending 'exit\r' to spawn id(3)
Expect::print('Expect=GLOB(0x1028abbc)', 'exit\x{d}') called a
+t test.pl line 15
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x1028abbc)', 5, 'F101') called at
+ test.pl line 16
spawn id(3): list of patterns:
#1: -ex `F101'
spawn id(3): Does `'
match:
pattern #1: -ex `F101'? No.
root@F101-8:~#
Thanks
Sri
IP address and password changed to protect the inocent (GrandFather) |