is it possible to loop a simple array with key and value with a string in the [key] part ?
#!/bin/bash -x
wget url://stringlist1
wget url://stringlist2
#cat/sed some stuff ....
declare -A targetarray
loop $resultfromstringlist1
in strlistarray1 # filled with ( aka1 kaka hu3hu blabla )
loop $resultfromstringlist2
in strlistarray2 # filled with ( Thoralf Mirkoslav Pjotr Jan )
i=0;
for e in strlistarray1
do
targetarray[$e]="${strlistarray2[$i]}"
((++i))
done
#wanted output
echo ${targetarray[aka1]} -> Thoralf
exit
i hope now is more clear
$e stays on $e its not filled with the string from strlist1 array
with manual setting works but not with loop bash version is 4.3
#!/bin/bash
unset aaaa
declare -A aaaa
str1="hans"
str2="klaus"
aaaa[$str1]="online";
aaaa[$str2]="offline";
echo ${aaaa[$str1]}
USER
" to be assigned to the array elementsa[aka_one]
a[aka_two]
anda[aka_seven]
I believe you wanted to do something else but can not figure out what.