Trying to assign value to a variable as follows
n=2
i='hello'
A$n='$i'
But getting error as "A2=hello: command not found
My aim is to assign 'hello' to A2 variable(by substituting $n as 2 in A$n)
CodePudding user response:
You can use declare
to achive this:
n=2
i='hello'
declare A$n=$i