如何从cgi-bin提供HTML?

如何从cgi-bin提供HTML?,html,bash,cgi,sh,openwrt,Html,Bash,Cgi,Sh,Openwrt,我在OpenWrt 12.09上运行uhttpd。我在/www/cgi-bin/test上有一个shell脚本,如下所示: #!/bin/sh echo "Content-type: text/html" echo "<p>It works!</p>" 系统或内核日志中没有错误 我可以去http://192.168.1.1/cgi-bin/luci并获得LuCI登录页面,这样其他CGI脚本就可以工作了。该文件具有不同的shebang(#!/usr/bin/lua),但两

我在OpenWrt 12.09上运行uhttpd。我在/www/cgi-bin/test上有一个shell脚本,如下所示:

#!/bin/sh
echo "Content-type: text/html"
echo "<p>It works!</p>"
系统或内核日志中没有错误

我可以去
http://192.168.1.1/cgi-bin/luci
并获得LuCI登录页面,这样其他CGI脚本就可以工作了。该文件具有不同的shebang(
#!/usr/bin/lua
),但两个脚本具有相同的权限和所有者


我做错了什么?

在HTTP头和正文之间必须有一个空行。此外,您可能希望提供一个完整的html文档

#!/bin/sh
echo "Content-type: text/html"
echo 
echo "<html><head><title>hello world</title></head><body><p>It works!</p></body>"
#/垃圾箱/垃圾箱
echo“内容类型:文本/html”
回音
echo“hello world它起作用了!


HTTP头和正文之间必须有一个空行。此外,您可能希望提供一个完整的html文档

#!/bin/sh
echo "Content-type: text/html"
echo 
echo "<html><head><title>hello world</title></head><body><p>It works!</p></body>"
#/垃圾箱/垃圾箱
echo“内容类型:文本/html”
回音
echo“hello world它起作用了!


在脚本末尾尝试退出0我的代码会导致非零退出状态吗?在脚本末尾尝试退出0我的代码会导致非零退出状态吗?