Need help writing a script in Linux/Unix

I am trying to write a script that will connect to a telnet site that I connect to often.  I don't want to have to type in the user info and stuff over and over.  I haved tried writing a simple script with the address and login info inline, but it only connects and doesn't input the info.  Is there some "wait for response" command or something I can use?  How should I handle this?
nchasteenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gurpreetsCommented:
You will have to write an interactive script. This can be done easily by using a very popular tool - expect. This is a freeware and is easily available. Install this tool on your system and give its path in your .profile. Then you can use the following script to connect the sysem.


#!/usr/local/bin/expect
set timeout -1
spawn telnet <Server-IP-Address>
expect "login"
send "<Username>\r"
expect "Password:"
send "<Password>\r"
expect "<Prompt (PS1)>"
interact
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.