Hi Revered Monks, I have the right characters to send a CNTRL-] which is: $ssh->send("\x1D"); However, it will only execute when I put it in this loop:
$ssh->waitfor('COR>',2) or die "Where is prompt"; my $line; while ( defined ($line = $ssh->read_all()) ) { $ssh->send("\x1D"); print $line . "\n"; }
When that code above is run it shows the return prompt which is "telnet>", of course then it loops forever. When I try to use the send statement in its proper place (below) it does not work.
$ssh->waitfor('COR>',2) or die "Where is prompt"; $ssh->send("\x1D"); $ssh->waitfor('telnet>',2) or die "Where is prompt"; $ssh->send("q"); $ssh->waitfor('>',2) or die "Where is prompt"; $ssh->send("touch /home/fworks/the.file"); $ssh->waitfor('>',2) or die "Where is prompt"; my $line; while ( defined ($line = $ssh->read_all()) ) { $ssh->send("bogus"); print $line . "\n"; }
The loop sending the bogus text shows that the return prompt is the previous prompt and the it never broke out of the telnet session. Clearly I am going about this all wrong. Thank you!

In reply to How to Send Cntrl-] Using Net::SSH::Expect by diex

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.