Showing results for 
Search instead for 
Do you mean 

script for telnet

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
Honored Contributor [Founder]

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
Highlighted
Honored Contributor [Founder]

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
Esteemed Contributor [Founder]

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