#!/bin/bash
declare -x MYSQLCONNSTR_MS_Mysql="Database=mydevwiki; Data Source=mw-mysql; User Id=root; Password=mysecretpassword"
declare -A mysqlconn
# Strip spaces, then convert semicolon to spaces to loop in array
# We must strip spaces since this is inconsistent used inside azure
for keyvaluepair in $(echo $MYSQLCONNSTR_MS_Mysql | sed "s/ //g; s/;/ /g")
do
ARR=(${keyvaluepair//=/ })
mysqlconn[${ARR[0]}]=${ARR[1]}
done
for i in "${!mysqlconn[@]}"
do
echo "key :" $i
echo "value:" ${mysqlconn[$i]}
echo "--------"
done
echo "For example get value of key Database:"
echo ${mysqlconn[Database]}