-->
🏠 🔍
SHAREOLITE

Beginners Linux shell web server CGI script to display HTML pages

Below mentioned is a simple beginners linux shell script which illustrates how to use linux script commands inside a web server CGI and display dynamic HTML webpages.

Copy the code below highlighted in blue , save it in a file and execute for output. You can copy this under your webserver cgi-bin directory
( Apache webserver Example : the directory which is configured under ScriptAlias in your apache httpd.conf file ) and check the html webpage output.

You may use any linux mathematical , logical , file operations etc commands and render dynamic webpages as shown in this example.

#!/bin/sh
echo "Content-type: text/html"
echo ""
cat << EOF
<html><head><title>Shareolite Linux scripts - Learning</title></head><body>
<table border="1" width="100%">
<tr>
<td width="182"><b><a href="shareolite.blogspot.com">
ShareOlite.blogspot.com</a></b></td>
<td>This is a very nice weblog to learn linux scripts for beginners. 
Click on this link to open their website</td>
</tr>
<tr>
<td width="182" bordercolor="#003399" bgcolor="#003399">&nbsp;</td>
<td bordercolor="#003399" bgcolor="#003399">&nbsp;</td>
</tr>
</table>
</body></html>
EOF

Hope this is useful to some Linux beginners
Comments

–>