bih71 has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am having problems with NET::TELNET from my pc to a unix platform and from there telnet to a second unix like platform. On the final platform I want to put it into a command mode. However the prompt I get back from the shell is not being recognised due to some odd characters being returned. My code is simply:-

$telnet->prompt('/> $/'); $telnet->print('ncli');
and the output I get is:-
$ ncli  [ManagedElement=1]> 
These last three characters in hex are 1B 5B 6D.

If I do the same operation manually from the same intermediate node (using the unix telnet command) I see:-

$ ncli [ManagedElement=1]>
Any ideas on how I can either live with these characters (i.e. make the prompt accept them) or stop them all together.

THanks...bih71

Replies are listed 'Best First'.
Re: Odd characters in Telnet prompt
by MidLifeXis (Monsignor) on Dec 05, 2008 at 16:46 UTC

    It seems to me that you may have ANSI escape characters in your prompt. Perhaps this is used for highlighting parts of the prompt on an appropriate device.

    Either turn off the fancy stuff on the remote side, have the remote side id your script and turn them off for you, or include the fancy characters as an alternation in your prompt string - \xFF (see perlre).

    --MidLifeXis

Re: Odd characters in Telnet prompt
by Perlbotics (Archbishop) on Dec 05, 2008 at 21:13 UTC