Bashでクエリ文字列から連想配列を取得するにはどうすればよいですか? - 試み:
#!/usr/bin/env bash
# Querystring (implementation stolen from http://stackoverflow.com/q/3919755)
function populate_querystring_array ()
{
param="$1"
query_dict="$2"
#for i in "${array[@]}"; do IFS="=" ; set -- $i; query_dict[$1]=$2; done
for ((i=0; i<${#param[@]}; i+=2))
do
query_dict[${param[i]}]=${param[i+1]}
done
}
q0='email=foo@bar.com&password=dfsa54'
declare -A querydict
populate_querystring_array "$q0" "$querydict"
printf "$querydict[email]"