I have the following case:
A=1
echo $A # output 1
B='A'
echo $B  # output A
echo "\$$B=2" # output $A=2
echo "\$$B=2" | eval # this won't set $A to 2
I'd like $A to get 2 as value.
I have the following case:
A=1
echo $A # output 1
B='A'
echo $B  # output A
echo "\$$B=2" # output $A=2
echo "\$$B=2" | eval # this won't set $A to 2
I'd like $A to get 2 as value.
 
    
    Found a solution using declare ( Dynamic variable names in Bash )
B='A'
declare "$B=2"
echo $A # output 2
