Link to home
Start Free TrialLog in
Avatar of xzhang
xzhang

asked on

How to create a shell script to automate telnet?

While I am login in my shool Unix system. I'd like
to do use telnet to get homepage, for example "telnet
cnn.com 80" "GET /index.html HTTP/1.0\n\n" This works.
But if I put "GET /index.html HTTP/1.0\n\n" into a
file . and do "telnet cnn.com 80<afile", this won't work.
Why?
Thanks
Avatar of ozo
ozo
Flag of United States of America image

If you have expect
expect -c 'spawn telnet cnn.com 80; expect "Connected"; send "GET /index.html HTTP/1.0\r\r"; expect "Connection closed"'
ASKER CERTIFIED SOLUTION
Avatar of dhughes111797
dhughes111797

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial