1748239 Members
3669 Online
108759 Solutions
New Discussion юеВ

script for telnet

 
Narasimham
Advisor

script for telnet

Hi

Is there any way to write a script , which telnets another system without prompting for userid and password (if userid and password info provided in the script) ??

Thanks in advance


Narasimham





3 REPLIES 3
harry d brown jr
Honored Contributor

Re: script for telnet

Yes,

And it's easy with perl's net::telnet module.

http://www.cpan.org

Also, do a search on this site (REMEMBER to CLICK ON COMMUNITY FORUMS) and enter in:

+perl +telnet +script

live free or die
harry
Live Free or Die
harry d brown jr
Honored Contributor

Re: script for telnet


Look at this thread:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x62777d4cf554d611abdb0090277a778c,00.html

and look for Clay's response. It's cool, quick, and easily done!

live free or die
harry
Live Free or Die
Printaporn_1
Esteemed Contributor

Re: script for telnet

Hi,

The best way is use EXPECT , but if you want simplest way try this:

----------
#!/bin/sh
(sleep 5
echo username
sleep 5
echo password
sleep 5
echo ls
sleep 5
echo exit) |telnet hostname
------------------

HTH
enjoy any little thing in my life