Hello !!!
I manually executed each of the steps in the scripts and it worked. I also ran the exact same script from a Linux m/c on x86 processor, in which I logined in to the Linux m/c with ppc processor using ssh and it works. It is possible that the issue is not with EXPECT but with the PTY package that EXPECT uses, any comments?? I have already tried replacing \r with \n and that didn't work either.
Thanks
Sri
============
ON A PPC M/C
============
root@F101-8:~# uname -a
Linux F101-8 2.6.10_mvlcge401-atca_f101 #25 Thu Jun 29 16:07:19 CDT 20
+06 ppc GNU/Linux
root@F101-8:~#
root@F101-8:~#
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 10.20.30.40 -l root\n");
$session->expect($timeout, "password:");
$session->send("pirates\n");
$session->expect($timeout, "F101");
$session->send("\n");
$session->expect($timeout, "F101");
$session->send("exit\n");
$session->expect($timeout, "F101");
root@F101-8:~#
root@F101-8:~#
root@F101-8:~# ssh 10.20.30.40 -l root
root@10.20.30.40's password:
Last login: Sun Jul 30 14:17:37 2006 from 10.17.194.85
-------------------------------------
Build View: tmproot_r6.1_dev-633914
ABC Version: GGGGG-ABC_R6.1_REL-02
HHH Version: HHH-BASE_R3.3_REL-01.01
NNNN Install Date: Fri Jul 28 22:38:37 UTC 2006
-------------------------------------
root@F101-8:~# exit
logout
Connection to 10.20.30.40 closed.
root@F101-8:~#
root@F101-8:~# exit
logout
Connection to 10.20.30.40 closed.
groovy::testuser>
==================
ON A Intel x86 M/C
Note that I am logining in to the PPC m/c from the intel m/c
==================
groovy::testuser>
groovy::testuser> ssh 30.40.50.60 -l root
root@30.40.50.60's password:
Last login: Fri Jul 28 08:23:34 2006 from dosim3-1
-------------------------------------
Build View: testuser_tmp-evtfil
ABC Version: GGGGG-ABC_R6.1_REL-02
HHH Version: HHH-BASE_R3.3_REL-01.01
NNNN Install Date: Thu Jul 27 11:15:02 CDT 2006
-------------------------------------
root@dosim3-1:~# uname -a
Linux dosim3-1 2.6.10_mvlcge401-pc_target-x86_pentium4 #1 SMP Sun Sep
+25 19:32:17 PDT 2005 i686 GNU/Linux
root@dosim3-1:~#
root@dosim3-1:~#
root@dosim3-1:~# cat test.pl
#!/usr/bin/perl5.8.4
use Expect;
my $timeout = 5;
$session = new Expect;
$session->exp_internal(1);
$session->spawn("ssh 10.20.30.40 -l root\r");
$session->expect($timeout, "password:");
$session->send("pirates\r");
$session->expect($timeout, "F101");
$session->send("\r");
$session->expect($timeout, "F101");
$session->send("exit\r");
root@dosim3-1:~#
root@dosim3-1:~#
root@dosim3-1:~#
root@dosim3-1:~# perl test.pl
Spawned 'ssh 10.20.30.40 -l root'
spawn id(3)
Pid: 22211
Tty: /dev/pts/2
Expect::spawn('Expect=GLOB(0x82a0fa8)', 'ssh 10.20.30.40 -l ro
+ot\x{d}') called at test.pl line 8
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x82a0fa8)', 5, 'password:') calle
+d at test.pl line 9
spawn id(3): list of patterns:
#1: -ex `password:'
spawn id(3): Does `'
match:
pattern #1: -ex `password:'? No.
root@10.20.30.40's password:
spawn id(3): Does `root@10.20.30.40\'s password: '
match:
pattern #1: -ex `password:'? YES!!
Before match string: `root@10.20.30.40\'s '
Match string: `password:'
After match string: ` '
Matchlist: ()
Sending 'pirates\r' to spawn id(3)
Expect::print('Expect=GLOB(0x82a0fa8)', 'pirates\x{d}') called
+ at test.pl line 10
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x82a0fa8)', 5, 'F101') called at
+test.pl line 11
spawn id(3): list of patterns:
#1: -ex `F101'
spawn id(3): Does ` '
match:
pattern #1: -ex `F101'? No.
spawn id(3): Does ` \r\n'
match:
pattern #1: -ex `F101'? No.
Last login: Sun Jul 30 14:40:39 2006 from 30.40.50.60
-------------------------------------
Build View: tmproot_r6.1_dev-633914
ABC Version: GGGGG-ABC_R6.1_REL-02
HHH Version: HHH-BASE_R3.3_REL-01.01
NNNN Install Date: Fri Jul 28 22:38:37 UTC 2006
-------------------------------------
spawn id(3): Does ` \r\nLast login: Sun Jul 30 14:40:39 2006 from 30.4
+0.50.60\r\r\n\r\n-------------------------------------\r\nBuild View:
+ tmproot_r6.1_dev-633914\r\nABC Version: GGG
+GG-ABC_R6.1_REL-02 \r\nHHH Version: HHH-BASE_R3.3_REL-01.
+01\r\nNNNN Install Date: Fri Jul 28 22:38:37 UTC 2006\r\n------
+-------------------------------\r\n'
match:
pattern #1: -ex `F101'? No.
root@F101-8:~#
spawn id(3): Does ` \r\nLast login: Sun Jul 30 14:40:39 2006 from 30.4
+0.50.60\r\r\n\r\n-------------------------------------\r\nBuild View:
+ tmproot_r6.1_dev-633914\r\nABC Version: GGG
+GG-ABC_R6.1_REL-02 \r\nHHH Version: HHH-BASE_R3.3_REL-01.
+01\r\nNNNN Install Date: Fri Jul 28 22:38:37 UTC 2006\r\n------
+-------------------------------\r\nroot@F101-8:~# '
match:
pattern #1: -ex `F101'? YES!!
Before match string: ` \r\nLast login: Sun Jul 30 14:40:39 2006 fr
+om 30.40.50.60\r\r\n\r\n-------------------------------------\r\nBuil
+d View: tmproot_r6.1_dev-633914\r\nABC Version:
+ GGGGG-ABC_R6.1_REL-02 \r\nHHH Version: HHH-BASE_R3.3_
+REL-01.01\r\nNNNN Install Date: Fri Jul 28 22:38:37 UTC 2006\r\
+n-------------------------------------\r\nroot@'
Match string: `F101'
After match string: `-8:~# '
Matchlist: ()
Sending '\r' to spawn id(3)
Expect::print('Expect=GLOB(0x82a0fa8)', '\x{d}') called at tes
+t.pl line 12
Starting EXPECT pattern matching...
Expect::expect('Expect=GLOB(0x82a0fa8)', 5, 'F101') called at
+test.pl line 13
spawn id(3): list of patterns:
#1: -ex `F101'
spawn id(3): Does `-8:~# '
match:
pattern #1: -ex `F101'? No.
spawn id(3): Does `-8:~# \r\n'
match:
pattern #1: -ex `F101'? No.
root@F101-8:~#
spawn id(3): Does `-8:~# \r\nroot@F101-8:~# '
match:
pattern #1: -ex `F101'? YES!!
Before match string: `-8:~# \r\nroot@'
Match string: `F101'
After match string: `-8:~# '
Matchlist: ()
Sending 'exit\r' to spawn id(3)
Expect::print('Expect=GLOB(0x82a0fa8)', 'exit\x{d}') called at
+ test.pl line 14
root@dosim3-1:~#
root@dosim3-1:~#
root@dosim3-1:~#
|