This article is from the the Brief Linux FAQ (BLFAQ) Maintained by Neil Zanella email@example.com
Surprisingly yes. Simply replace the words "remote-host", "username", and "password" in the following expect script and do a "chmod +x name-of-script". You can then simply invoke the script to log into the remote host.
#!/usr/bin/expect eval spawn telnet remote-host set timeout 20 expect ogin: send "username\r" expect assword: send "password\r" sleep 2 interact
Alternatively you can try out the ktelnet program.