Create a World Wide Web gateway on

First, make yourself a home page if you have not already done so.

Create a subdirectory of your public_html directory named cgi-bin. "cgi-bin" has a dash, "public_html" has an underscore. Chmod the directory to rwxr-xr-x if it does not already have these permissions.

Use any editor (ed, vi, emacs, etc.) to create the following program in your cgi-bin subdirectory and name it mycal.cgi. Chmod the program to rwxr-xr-x.

The program must output an html file with two additional lines at the beginning. The <PRE> and </PRE> tags prevent the browser from rearranging the output of cal into paragraphs.

#Gateway to output a calendar of the current month.

title="`cal | awk 'NR == 1 {print $1, $2}'` Calendar"

echo 'Content-type: text/html'
echo '<HTML>'
echo '<HEAD>'
echo "<TITLE>$title</TITLE>"
echo '</HEAD>'
echo '<BODY>'
echo "<H1>$title</H1>"
echo '<PRE>'
echo '</PRE>'
echo '</BODY>'
echo '</HTML>'
exit 0

Now put the following sentence in your index.html file:
<A HREF = "">here</A>
to see a calendar of the current month.