Usually in Bash scripting, we define a variable by giving it a name. and reference it later by using that name in the form of ‘${variable_name}’. This is the usual use case. However, there is another unusual use case. The value of a variable is the name of another variable. We want to get the value of the another variable, say ‘variable_b’, through the variable, say ‘variable_a’, containing the name of the another variable. This can be done by using the form ‘${!variable_a}. This syntax will take the value of variable ‘variable_a’, which is ‘variable_b’. Then the value ‘variable_b’ is taken as the name of a variable and then is dereferenced. This is called variable indirect expansion. The below links can be referenced.
https://stackoverflow.com/questions/16553089/dynamic-variable-names-in-bash