Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using NET:TELNET

Status
Not open for further replies.

dod123

Programmer
Dec 13, 2004
20
IL
Hello all;

I am using the Net::Telnet module from CPAN, the problem srarts when i have diffrent prompt in the telnet server.
in the first example from CPAN:

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;

I have two posibels prompts: abcd01-esme% or Enter Command [s=sef][c=clr][e=exit][R=Rep]:

I need any help.
Thanks.

 
Hello dod,

You can put a regular expression in the Prompt string - so it's easy to match one of two strings, like this:

Prompt => '/bash\$ $|ksh\$ $/

That will match either of these two shell prompts:

bash$

or

ksh$



Mike

To err is human,
but to really foul things up -
you require a man Mike.

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top