Friday, July 22, 2011

simple cgi shell script

You just print out an html page. The only other thing you have to care about is outputting:
Content-type: text/html

(followed by two newlines characters)
And then, as long as your apache settings are working and the file has executable permission (chmod a+x filename), your browser should display the proper page.

#!/bin/sh
#you need this part for cgi handling
printf "Content-type: text/html\n\n"

# contents
echo "<html>"
echo "<head><title>Dude</title></head>"
echo "<body>"
echo "<h1>some header</h1>"
echo "awesome"
echo "</body>"
echo "</html>"

No comments:

Post a Comment

Sociable