Telnet usename and password

I am creating a spec file for RPM and I have a shell script that I am working on. The ojective to to telnet to a server, switch to the appropriate directory, run another shell script and then exit once the script is completed.

telnet <ipaddress>
echo <user>
echo <pass>
echo cd <directory>
run shell script
echo exit

I have searched and tried some of the examples but I am just not getting it...:confused: Any help would be greatly appreciated.

Well that will not work the way your writing it. You could use the expect language to accomplish it but it sounds like a very bad idea and I highly recommend against doing it.

what are you trying to achieve?

I know this probably is not any help, but I used to configure cisco routers and switches all the time via telnet command line interface. I could not write a file that telneted in and did the password and everything, what I did was telnet to the router or switch, and then paste everything into a hyperterinal telnet session including the username and password.

I think you need to use rcmd or rsh

.. however you will get full marks if you use ssh with an public/private key pair.

you have Perl on your system? if you have and is able to use it, follow this reading

My ultimate goal is to be able to run a shell script on another machine. It is for testing purposes for something else.

Is expect available and are you willing to spend a couple hours getting up to speed with it? If so it's trivial: As an added bonus you can make it nearly bulletproof.