using shell script to telnet

I have had some success with a ksh coprocess. Example:
changepass automate password changes on multiple systems