So I reviewed the other thread and looked at FAQ. I am using Data Dumper now, still no luck.
I wrote a smaller program to ssh to another unix server and I get the same issue, right after i send the user password for login (that works ok, I get my login completed), I cannot send or expect anything else after that procedure completes. Right after the login procedure completes, i try to send a ls command and expect - all i get is timeout:
screen shot:
Sending ls command!
Starting EXPECT pattern matching...
at /export/dmzsupp/perl5/5.14.2/lib/site_perl/5.14.2/Expect.pm line 5
+61
Expect::expect('Expect=GLOB(0x65ca28)', 6, 'ARRAY(0x9b6460)',
+'ARRAY(0x9b6328)', '-re', 'Regexp=REGEXP(0x9990d8)') called at ./fwlo
+gin.pl line 42
Error,Timeout while waiting 6 secs for ls command on [sol8server] user
+[user]. Error:1:TIMEOUT
Continuing
$VAR1 = [
undef,
'1:TIMEOUT',
undef,
'',
undef,
undef
];
The code:
print "\nSending ls command!\n\n";
$sshFW->send("ls\r");
@exp_stat = $sshFW->expect($expTimeOut,
# Timeout trap
[timeout =>
sub {
$expFWStatus = 1;
$expFWmatchString = $sshFW->match;
print "Error,Timeout while waiting $expTimeOut secs for ls com
+mand on [$FWHost] user[$usr]. Error:" . $sshFW->exp_error() . "\n";
+
}
],
# EOF trap
[eof =>
sub {
$expFWStatus = 2;
$expFWmatchString = $sshFW->match;
print "Error,Premature EOF during ls command for [$FWHost] use
+r[$usr]. Error:" . $sshFW->exp_error() . "\n";
}
],
'-re', qr /% $/,
); # End expect, got Unix prompt ok
print "\nContinuing\n\n";
print Dumper(\@exp_stat);#debug
# The above behaves just like the ls command was never sent!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.