in reply to Re^5: Expect package not working on a Power PC machine
in thread Expect package not working on a Power PC machine

Hi again, sri75,

Yes, I have another suggestion.  Try taking out the carriage-return (or newline) from your spawn command, by changing from:

$session->spawn("ssh 10.20.30.40 -l root\r");

to:

$session->spawn("ssh 10.20.30.40 -l root");

That may be the reason you're getting an extra, unExpected newline in your response.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^7: Expect package not working on a Power PC machine
by sri75 (Novice) on Jul 31, 2006 at 02:07 UTC
    Tried your suggestion, but no luck. Check out below ...
    root@F101-8:~/sgopala1# root@F101-8:~/sgopala1# 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"); $session->expect($timeout, "pirates:"); $session->send("motorola\n"); $session->expect($timeout, "F101"); $session->send("\n"); $session->expect($timeout, "F101"); $session->send("exit\n"); $session->expect($timeout, "F101"); root@F101-8:~/sgopala1# root@F101-8:~/sgopala1# root@F101-8:~/sgopala1# root@F101-8:~/sgopala1# perl test.pl Spawned 'ssh 10.20.30.40 -l root' spawn id(3) Pid: 31038 Tty: /dev/pts/2 Expect::spawn('Expect=GLOB(0x1028abc8)', 'ssh 10.20.30.40 -l r +oot') called at test.pl line 9 Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0x1028abc8)', 5, 'pirates:') calle +d at test.pl line 10 spawn id(3): list of patterns: #1: -ex `pirates:' spawn id(3): Does `' match: pattern #1: -ex `pirates:'? No. Sending 'motorola\n' to spawn id(3) Expect::print('Expect=GLOB(0x1028abc8)', 'motorola\x{a}') call +ed at test.pl line 11 Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0x1028abc8)', 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 '\n' to spawn id(3) Expect::print('Expect=GLOB(0x1028abc8)', '\x{a}') called at te +st.pl line 13 Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0x1028abc8)', 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\n' to spawn id(3) Expect::print('Expect=GLOB(0x1028abc8)', 'exit\x{a}') called a +t test.pl line 15 Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0x1028abc8)', 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:~/sgopala1# root@F101-8:~/sgopala1# root@F101-8:~/sgopala1#
      Hello, Something was wrong with my Perl-5.8.4 installation. I de-installed the perl package and re-installed it from scratch on my PowerPC m/c and then installed the EXPECT package on top. After which my test perl scripts started working. Not exactly sure what was wrong with my initial setup. Thanks a lot for all your suggestions. Regards Sri