Show CGI variables on UNIX

With the script in this document you can see which CGI variables are known on your UNIX system. Create a new file called for example showenv.cgi

1. Save this file in the <install dir>/c8/webcontent directory.

2. Open a web browser and execute script
http://<unixserver>/cognos8/showenv.cgi

3. in your browser you will see all CGI variables and their content of your UNIX system

#!/bin/sh

TmpOutFile=/tmp/webenv_control.$$
rm -f $TmpOutFile

subst_html()
{
echo $1 | sed -e 's^%2F^/^g'
}

# Get parameter and analyse them
if [ "$REQUEST_METHOD" = "GET" ]
then
pl=`echo $QUERY_STRING | sed -e 's-&- -g'`
else
read inData
pl=`echo $inData | sed -e 's-&- -g'`
fi

set -- $pl
pc=1
while [ $# -gt 0 ]
do
p=`echo $1 | awk '{print $1}' FS==`
v=`echo $1 | awk '{print $2}' FS==`

pc=`expr $pc + 1`
shift

echo "<tr><td>$p</td><td>$v</td></tr>" >> $TmpOutFile

done

echo ""
echo "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">"
echo "<html>"
echo "<title>Show Wen Environments - Cognos</title>"
echo "<body>"
if [ $pc -gt 1 ]
then
echo "<table border=1>"
cat $TmpOutFile | sort
echo "</table>"
fi
echo "<p>Environment variable:</p>"
echo "<table border=1>"
env | sort | sed -e 's-^-<tr><td>-' -e 's-=-</td><td>-' -e 's-$-</td></tr>-'
echo "</table>"
echo "</body>"
echo "</html>"

rm -f $TmpOutFile
exit 0