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