#!/bin/bash # test-cgi.sh # by Michael Zick # Used with permission # May have to change the location for your site. # (At the ISP's servers, Bash may not be in the usual place.) # Other places: /usr/bin or /usr/local/bin # Might even try it without any path in sha-bang. # Disable filename globbing. set -f # Header tells browser what to expect. echo Content-type: text/plain echo echo CGI/1.0 test script report: echo echo environment settings: set echo echo whereis bash? whereis bash echo echo who are we? echo ${BASH_VERSINFO[*]} echo echo argc is $#. argv is "$*". echo # CGI/1.0 expected environment variables. echo SERVER_SOFTWARE = $SERVER_SOFTWARE echo SERVER_NAME = $SERVER_NAME echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE echo SERVER_PROTOCOL = $SERVER_PROTOCOL echo SERVER_PORT = $SERVER_PORT echo REQUEST_METHOD = $REQUEST_METHOD echo HTTP_ACCEPT = "$HTTP_ACCEPT" echo PATH_INFO = "$PATH_INFO" echo PATH_TRANSLATED = "$PATH_TRANSLATED" echo SCRIPT_NAME = "$SCRIPT_NAME" echo QUERY_STRING = "$QUERY_STRING" echo REMOTE_HOST = $REMOTE_HOST echo REMOTE_ADDR = $REMOTE_ADDR echo REMOTE_USER = $REMOTE_USER echo AUTH_TYPE = $AUTH_TYPE echo CONTENT_TYPE = $CONTENT_TYPE echo CONTENT_LENGTH = $CONTENT_LENGTH exit 0 # Here document to give short instructions. :<<-'_test_CGI_' 1) Drop this in your http://domain.name/cgi-bin directory. 2) Then, open http://domain.name/cgi-bin/test-cgi.sh. _test_CGI_