telnet in a script

Does anyone have a script that contains the telnet command and passes the login and password in the script as well?

If you want to send the password automatically I would recommend using ssh instead. It can do this in a secure way.

I have to add caution on this reply (stating that SSH should be used).

Security is an operational risk management decision based on the risk management profile and the operating environment. The user in his orginal post did not express a concern for security, he/she expressed a concern trying to create an automated telnet session.

Automating a telnet session has no greater security implications that manually doing it. Hence, if there were no great security concerns to the user doing it manually, then there is not much more risk automating it (with the exception of storing the telnet password in the script).

This does not mean that SSH is not a great idea. But the technical issue of how to write a script to automate a telnet session (which can be applied to many similar sessions) was the core issue.

I love SSH, but there are simply many people who will still use telnet (for many reasons).

Okay so now that we understand my original issue (thank you Neo), does anyone have an example?

This thread is being discussed in another forum. Let's close this one and try to avoid posting the same idea in two different forums.