initial commit

master
Bryan 2020-12-18 20:11:03 -06:00
commit aac757bade
1 changed files with 17 additions and 0 deletions

17
parse_query_string.sh Normal file
View File

@ -0,0 +1,17 @@
#! /bin/bash
# This will parse the variable $QUERY_STRING.
# The values will be stored in an associative array.
# The value for a key will be stored in the array element `${param[<KEY>]}`
saveIFS=$IFS
IFS='=&'
XXQuery_string=($QUERY_STRING)
IFS=$saveIFS
declare -A param
for ((i=0; i<${#XXQuery_string[@]}; i+=2))
do
param[${XXQuery_string[i]}]=${XXQuery_string[i+1]}
done