Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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
Highlighted
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