how to write a shell script to login to a system which is interactive.

Can anybody help me to write a shell script to login interactive system
once u open a connection using telnet it will ask for

USERCODE:
PASSWORD:
DOMAIN:

You could try using expect. Do a search in these forums and you should find more on it.