Bourne/ Bash Shell CGI Scripts

Nov 1st, 2008

Usually I do my server-side scripting in Perl, but some time
ago when writing CGI scripts for an embedded system I ran into memory
and flash space contraints. Because the system used Busybox, I
had the Bourne compatible ash shell available.
So I wrote a very small Bourne shell script to include in my CGI scripts,
which I share here, maybe it is of use to someone.
(Of course this will work in the Bash shell as well.)

Caveat Emptor:
This code is probably one big security hole waiting to happen,
interactive shells and the Internet don’t mix very well, please
use wisely. :)

This code can be then be used in your CGI scripts like so, for example
this little script, that simply displays all posted variables.
All posted variables, together with those in the query string in
the URL are prefixed with F_ which makes this small example very
simple: