I am trying to create a Variable from value of another variable and trying to store value into the created variable in Shell Script. For Example:
Let there is a existing variable i=1
I am trying to store value in var_$i
I have tried:
i=1 "var_$i"='true' echo "$var_1"
Output: bash: var_1=true: command not found
AND
i=1 var_indirect="var_$i" ${!var_indirect}='true' echo "$var_1"
Output: bash: =true: command not found
I am expecting:
echo $var_1
will give the output true