how to write bash shell CGI under uHTTPd
Posted nicephil
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了how to write bash shell CGI under uHTTPd相关的知识,希望对你有一定的参考价值。
how to write bash shell CGI under uHTTPd
Target
Want to provide the smaple RESTful server under uHTTPd on OpenWRT, I select the bash script for a demo
Reference
Bash CGI
Web CGI with Bash Script
PostMan Tester
WWW ROOT Dir on OpenWRT
/www/cgi/test.cgi
- #!/bin/sh
- POST_STRING=$(cat)
- echo "Content-type: application/json"
- echo ""
- echo "$POST_STRING"
uHTTPd passes ‘GET’ paramter to bash by ‘$QUERY_STRING’
uHTTPd passes ‘POST’ conent to bash by STDIN, so bash use ‘POST_STRING=$(cat)’ to get them
Browser Client Access
http://192.168.254.219/cgi-bin/test.cgi
[email protected] 2017-4-21
以上是关于how to write bash shell CGI under uHTTPd的主要内容,如果未能解决你的问题,请参考以下文章
How to write threats to validity?
How to Catch Ctrl-C in Shell Script
How to set the bash display to not show the vim text after exit?
[译注]How to Write a 21st Century Proof