I have nothing else to add to this, but if possible, use ssh, telnet is not encrypted, so it's highly unsecure if someone indeed is "listening"
oh, one more addition:
#!/usr/bin/sh
# Shell script to connect via ssh to host
ssh -l [username] [host]
that -l option logs you in with...