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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
expect -c 'spawn telnet cnn.com 80; expect "Connected"; send "GET /index.html HTTP/1.0\r\r"; expect "Connection closed"'