I have a bash scripting question. I am trying to create the following code, however, it does not work properly. This leads me to wonder if it is even possible. I hope someone on here can figure it out.
MYSQL_DB_MyDatabase_USERS_username_PASSWORD=Password
DATABASE_NAME=MyDatabase
DATABASE_USER=username
DATABASE_PASS_TEMP=MYSQL_DB_${DATABASE_NAME}_USERS_${DATABASE_USER}_PASSWORD
echo $DATABASE_PASS_TEMP
I would want the output to be "Password" (the original variable). I am getting an error and I know I have incorrect syntax. I have googled around and found that using one variable in the variable name, one would use echo "${!DATABASE_PASS_TEMP}", but that does not work when using two dynamic variables. Thanks in advance for any help you can give.