Re: script for telnet (104 Views)
Reply
Advisor
Narasimham
Posts: 38
Registered: ‎12-11-2001
Message 1 of 4 (104 Views)

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





Please use plain text.
Honored Contributor
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 2 of 4 (104 Views)

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
Please use plain text.
Honored Contributor
harry d brown jr
Posts: 8,418
Registered: ‎12-12-2000
Message 3 of 4 (104 Views)

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
Please use plain text.
Esteemed Contributor
Printaporn_1
Posts: 609
Registered: ‎02-06-2001
Message 4 of 4 (104 Views)

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
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation