need help in telnet connection:

i have 2 servers

test1
production2
------------------------------------

i have script called naveed2.sh in test1.Actually i m trying to connect from scritp naveed2.sh into server production2.

below the contents of script naveed2.sh

#!/bin/ksh

telnet production2.com< n2.txt
-------------------------------------------------------------------------

Actually the problem is how to pass username and password of production2 from script naveed2.sh ?????

I recommend 'expect' or 'rsh' command.

Hello Ali,
You can try the following:
(echo <user id>; sleep 1; echo <password>)| telnet $SERVER
Although I didnt exactly understand the purpose of the <n2.txt part.
Thanks.