Here's a small example which shows the output of two commands and refreshes itself.
Code:
#!/bin/bash --
echo -en "Content-type: text/html\n\n<META HTTP-EQUIV="REFRESH" CONTENT="10\;URL=http://localhost/httpd/html/bash-cgi/combo.cgi">\n"
echo "<html><head><title>OS Version</title></head><body><H1>"; /usr/bin/uname -r
echo "</H1>"
echo "<hl>"
echo "<H2>"; /usr/bin/date
echo "</H2>"
echo "</body></html>"
It's important to note that the commands will be executed by the httpd server you are running, so they will run with the same username and group as the server itself. You have to be careful about what commands you let be run...
You can use it by placing it in your cgi-bin dir and making it executable, or you can change the name of it and open it directly in your browser.