The following shell script is very simple. It sends an HTML page to the client showing the current date in bold type. Figure 3.2 shows the page as a user would see it in Netscape Navigator.
A CGI shell script that prints the current date
#!/bin/sh
# Print out necessary header and empty line
echo "Content-type: text/html"
echo ""
# Print out a title and text. Note the HTML tags in the strings.
echo "<TITLE>The current date!</TITLE>"
echo ""
echo "<H1 align=center>The current date</H1>"
echo "<hr>"
echo ""
echo "Today's date is <b>"
# Echo the date
date +"%a %b %e, %Y"
# Clean up HTML page. Note the ending bold tag.
echo "</b>"
echo "<hr>"