English 中文(简体)
网播: 网上服务器
原标题:Script telnet on webserver

我想通过文字电话,测试我网站的投入处理。 我可以人工操作:

telnet localhost 8888
...
GET / HTTP/1.1

Host: localhost


...html response

但我可以把我手脚的照片传到电话网!

我尝试:

(echo "GET / HTTP/1.1
"; echo "Host: localhost 

"; sleep 1) | telnet localhost 8888

它没有任何结果!

最佳回答

(Probably not the only issue) You should "echo -en", and use single quote to close strings. This makes bash interpret correctly

关于

问题回答

我认为,netcat, aka nc更适合这一类任务。

Also as Giuseppe mentions you ll have to fix the quoting. An alternative to bash -e is to quote using $ this form , in which , , etc. are interpreted by bash when parsing the command line rather than being passed on to echo. So that form is applicable to many different utilities.

“How do I script x?”的通常答案是“expect





相关问题
What does it mean "to write a web service"?

I just asked a question about whether it was possible to write a web-page-checking code and run it from free web server, and one supporter answered and said that it was possible only if I run "a web ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Ivy, ant and start scripts

I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...

热门标签