Hi, I need help with the following issue where in interactive menu selection works fine manually but fails with perl ssh expect. When executing manually i get the following:
Please enter the operation serial number. >1 NO. NE name + NE type name + 1 TB2SEE + HW_SEE + 2 UKTB2SEE + HW_SEE + 3 TB2SLEE + HW_SLEE + 4 UKTB2SLEE + HW_SLEE + ***************Input Tips************* a: To create a tracing task for an NE, enter the NE number. b: To create a tracing task for multiple NEs, enter the NE numbers and + separate every two of them with a plus sign (+). Example: 1+2. c: To create a tracing task for all NEs, enter 0. ************************************** Please enter the NE serial number. >
but when i run it from perl i get the following:
main::(iTrace_start_stop.pl:48): $ssh->waitfor('Please\senter\s +the\soperation\sserial\snumber.\s*', 2) or die "prompt 'operation ser +ial number' not found after 2 second"; DB<1> main::(iTrace_start_stop.pl:49): $ssh->send("1"); DB<1> main::(iTrace_start_stop.pl:50): print $ssh->peek(1); DB<1> >1 NO.NE nameNE type name ---- More (Enter to show More) ----
My code is as follows:
$ssh->waitfor('Please\senter\sthe\soperation\sserial\snumber.\s*', 2) + or die "prompt 'operation serial number' not found after 2 second"; $ssh->send("1"); print $ssh->peek(1); $ssh->send("2");

In reply to Re^4: ssh using expect by Anonymous Monk
in thread ssh using expect by bala_999

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.