bashlib
If the idea of writing CGI in bash scares you, you obviously have either written not enough CGI, not enough bash, or too much of either (or both). bashlib is the beautiful little script you source to give you parameter and cookie goodness with no effort whatsoever. Behold:
#!/bin/bash
. /usr/local/lib/bashlib
echo "Content-type: text/html"
echo
p=`param addr`
if [ "x$p" = "x" ]; then
p="192.168.0.1/24"
fi
cat <<EOF
<html><body>
<h1>IP Calculator</h1>
<p>
<form action="ipcalc.cgi">
<input type="text" name="addr" value="$p" />
<input type="submit" />
</form>
</p>
<pre>
`ipcalc $p`
</pre>
</body></html>
EOF
Yes, I know that is terribly insecure, (You don't see me giving you a link to try it out, do you?) but those problems are not unique to CGI with bash.


