#!/bin/bash
# *********************************************************
# file: querystring.sh
# date: 18.10.2004
# author: (c) by Marko Schulz - <mschulz@jamba.net>
# description: Get the form data from QueryString.
# *********************************************************
# example of script call:
# http://www.doman.de/cgi-bin/querystring.sh?src=xxx&target=yyy
# Scanning the QUERY_STRING and save the values/pairs
# as elements in the array "QUERYSTRING".
declare -a QUERYSTRING=( $( env | grep 'QUERY_STRING' | sed 's/QUERY_STRING=//g' | sed 's/&/ /g' ) )
# Loop the array "QUERYSTRING" and save each
# form name as variable with its value.
for element in ${QUERYSTRING[@]}; do
name=$( echo $element|cut -d= -f1 )
value=$( echo $element|cut -d= -f2 )
eval $name=\'$value\'
done
# Dumb HTML-Header.
echo -en "Content-Type: text/html\n\n"
# Dumb Variables.
echo "Source: ${src}"
echo "Target: ${target}"
# *********************************************************
# end of this script...