diex has asked for the wisdom of the Perl Monks concerning the following question:
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"; my $line; while ( defined ($line = $ssh->read_all()) ) { $ssh->send("\x1D"); 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!$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"; }
|
|---|