Create a World Wide Web gateway on oit2.scps.nyu.edu

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.


#!/bin/sh
#Gateway to output a calendar of the current month.

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

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

Now put the following sentence in your index.html file:
Click
<A HREF = "http://oit2.scps.nyu.edu/~abc1234/cgi-bin/mycal.cgi">here</A>
to see a calendar of the current month.