ksh telnet script

I am trying to write a ksh script of using telnet.
On server1, I have a script that wants to telnet to server2 and run it on server2. Then after finish, brings back information to server1. Is it possible? How can I write it on ksh?

Any feekback is appreciated.

Here is a script that does that...
changepass automate password changes on multiple systems

Thanks for the reply.
In your answer, at the section 1 part 3, the script tried to delete the output file at the remoted server or you meant to delete at the local server?
After FTP the output file back to the local server at part 2, I assume you want to delete the output file at the remote server. Therefore, the part 3 of section 1 should somehow use telnet command statement like in part 1. right?
can you please help me to clearify my confusion?

Million thanks.

Robert

In section 1 part 3 the script is deleting the file from the local server, not the remote server. After the password is changed, it will ftp to the remote server again, using the new password, and retrieve the file a second time. This guarantees that the password change took effect. The remote file is then deleted.

Maybe this is a really dumb question but: why don't you use rsh/rexec/remsh/et al. for this very purpose? Aren't these tools designed exactly for your situation?

bakunin

The BSD R-commands are the least secure networking commands ever written. Many sites prohibit their use.