Telnet is an interactive appliacation, so I do not belive that you can
redirect anything to it. But if you use "expect" telnet will think that you
are typing at the keyboard.
Ex:
#!/usr/local/bin/expect -f
spawn telnet HOSTNAME 80
send "GET index.phtml\r"
expect eof
Best regards
Jan Birk
...
> > Hi:
> > How do I invoke telnet inside a ksh script. Like i want to telnet to
> > port 80(http) of a machine do a GET /some.html and come out of that
> > script.
> > Any Help WOW will be a life saver
> > Thanks
> telnet somehost.com 80 < command-file > output
> command-file is the name of the file which commands to telnet are put
> in. it would read as follows
> GET /path/to/file.html
> and output would be the output from the webserver.
> Very simple.
> - Mike
> --
> ,-._.-._.-._.-._.-.
> `-. ,-'
> | | Michael B. Trausch
> | I love Linux! In | | | AIM: CSMFSOBW
> | fact, so does my mom! | | | ----------------------
> | | ,';".________.-. Need your computer
> | Wait'll I tell Big | ;';_' )] upgraded or repaired?
> | Bill that my mom | ; `-| E-mail me!
> | uses Linux! `. `T- | ----------------------
> `----------------------._ \ | |
> `-; | |
> |..________..-|
> /\/ |________..|
> ,'`./ >,( |
> \_.-|_/,-/ ii | |
> `."' `-/ .-"""|| |
> /`^"-; | ||____|
> / / `.__/ | ||
> / | ||
> | ||
> Sent via Deja.com http://www.deja.com/
> Before you buy.