I would use an array in this case. For instance:
$ i=a $ sd[$i]=true $ echo ${sd[a]} true
As another poster stated, if you want to do this without an array, you can instead create a local variable using syntax like declare sd$i=true . If you want to create a global variable, use export sd$i=true .
source share