#!/bin/sh # create the document root and the cgi-bin dir mkdir -p /var/www/html/cgi-bin # populate the document root with an index.html showing the eth0 information ifconfig eth0 | grep Bcast > /var/www/html/index.html # now let's show the same information dynamically via cgi cat > /var/www/html/cgi-bin/test.cgi <<'EOF' #!/bin/sh echo "Content-type: text/plain" echo echo "Hello World from:" ifconfig eth0 | grep Bcast echo echo Sleeping a little to keep the session active sleep 120 EOF # needs execution bit chmod +x /var/www/html/cgi-bin/test.cgi # start the web server /usr/sbin/httpd -p 80 -h /var/www/html