通过 CGI 将字符串传递给 shell 脚本
Pass string to a shell script through CGI
我想将用户以简单 HTML 形式提交的字符串传递给 shell 脚本,就像下面的形式一样。
到目前为止我还没有找到答案。我会很感激任何提示。
<form method="post" action="http://example.com/cgi-bin/echo.sh">
<input type="text" name="Text" value=""><br>
<input type="submit" value="Submit">
</form>
并且 shell 脚本应该打印它捕获的值。
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>Echoing argument</title>'
echo '</head>'
echo '<body>'
echo
echo '</body>'
echo '</html>'
This article 帮助解决了这个问题。
我必须在 echo
.
之前添加 set $QUERY_STRING
行
我想将用户以简单 HTML 形式提交的字符串传递给 shell 脚本,就像下面的形式一样。
到目前为止我还没有找到答案。我会很感激任何提示。
<form method="post" action="http://example.com/cgi-bin/echo.sh">
<input type="text" name="Text" value=""><br>
<input type="submit" value="Submit">
</form>
并且 shell 脚本应该打印它捕获的值。
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>Echoing argument</title>'
echo '</head>'
echo '<body>'
echo
echo '</body>'
echo '</html>'
This article 帮助解决了这个问题。
我必须在 echo
.
set $QUERY_STRING
行