commit aac757bade704d97d7c39459e8507453bd90f25e Author: Bryan Date: Fri Dec 18 20:11:03 2020 -0600 initial commit diff --git a/parse_query_string.sh b/parse_query_string.sh new file mode 100644 index 0000000..e2e8bf5 --- /dev/null +++ b/parse_query_string.sh @@ -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[]}` + +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 +