Reading response from server

I am trying to write a korn shell script which posts commands to a server and read the response back from the server.

Any idea how I can read the servers response?
I have tried doing the following:

(
LOGIN:xxxxx
command to server
read ANSWER
echo $ANSWER >file1
) | telnet server port

This connects - sends command - but I do not see the response...

if using ssh from one server to another that has been set up to allow login without a password being sent, then

ssh server2 uptime > /tmp/uptime.server2

will work and place the output into /tmp/uptime.server2 on server1.

Or you might look into using Expect if you can't use ssh.

hmnn

I need to send a few hundred commands to this server and read answer from each individual command..

Any suggestions?

I don't see how that is working for you. I get:
LOGIN:: not found
which is what I would expect.

But if it is working, have that command send the output to a file on the remote server (and thus local to the command running on the server). Then ftp it back.

hi...

LOGIN is for a application process on the server....
This works okay.....

just not sure how to trap the output returned to the login...
I will keep searching...thanks anyway