How to convert a UNIX shell script to a cgi script that runs over the web.
1. Take a shell script. For example, here's a script which writes strings backwards:
b="" for i in `echo $1|sed 's/./&\ /g'` do b=$i$b done echo $b |
2. Add three "magic" lines to the beginning of the code:
#!/bin/sh echo "Content-type: text/html" echo b="" for i in `echo $1|sed 's/./&\ /g'` do b=$i$b done echo $b |
3. Move (or copy) the script into your public_html/cgi directory:
$mv reverse public_html/cgi |
4. Point your web browser at its url with the list of parameters following a "?" and separated by "+".
5. If you like, make a web page that calls the script, like this page; or better, yet,
let the script rebuild itself dynamically, like this
or
frame the content in a page with multiple frames.