Recently, I was developing an script to automate telnet logins to do some transactions on other server. I tried a lot for two days but failed, on the third day I came across the package called expect which could fulfill my need.
All you need on your Linux Distro is a package called “EXPECT” which is freely available.
Here’s the sample code on how to automate Telnet Logins..
expect << EOF
set timeout 20
spawn telnet 10.0.0.254
expect “login: “
expect “Password: “
send “touch m12345\r”
Note: the “\r” in every send command means the input from the user over & the data entered to be processed. (carriage return)