I am trying to create a dictionary of key value pair using Bash script. I am trying using this logic:
declare -d dictionary
defaults write \"$dictionary\" ke
If you can use a simple delimiter, a very simple oneliner is this:
for i in a,b c_s,d ; do
KEY=${i%,*};
VAL=${i#*,};
echo $KEY" XX "$VAL;
done
Hereby i is filled with character sequences like "a,b" and "c_s,d". each separated by spaces. After the do we use parameter substitution to extract the part before the comma , and the part after it.