one of my recent tasks includes creating a dictionary structure in Linux Shell. I have tried below code
declare -A item_1
item_1["value"]="hello"
temp=item_1
eval result="${item_1["value"]}" #Approach 1
eval result="${$temp["value"]}" #Approach 2
echo $result
by doing this Approach 1 can get value "hello", but how can I get Approach 2 print the same value by using $temp?