Bash supports indirect expansion:
$ FOO_BAR="foobar"
$ foo=FOO
$ foobar=${foo}_BAR
$ echo ${foobar}
FOO_BAR
$ echo ${!foobar}
foobar
This should support the nesting you are looking for.
More Related Contents:
- Correct Bash and shell script variable capitalization
- Using getopts to process long and short command line options
- How do I compare two string variables in an ‘if’ statement in Bash? [duplicate]
- Brace expansion with a Bash variable – {0..$foo}
- “~/Desktop/test.txt: No such file or directory”
- How do I run a shell script without using “sh” or “bash” commands?
- Bash Templating: How to build configuration files from templates with Bash?
- Remove the last line from a file in Bash
- How to avoid bash command substitution to remove the newline character?
- How to keep quotes in Bash arguments? [duplicate]
- Bash: Capture output of command run in background
- Pass all variables from one shell script to another?
- Checking if output of a command contains a certain string in a shell script
- Multi-line bash commands in makefile
- Using the && operator in an if statement
- Unexpected operator error [duplicate]
- How does the leading dollar sign affect single quotes in Bash?
- Bash inserting quotes into string before execution
- Get just the filename from a path in a Bash script [duplicate]
- Rename multiple files in shell [duplicate]
- Is there a way to make bash job control quiet?
- How to store the output of a command in a variable at the same time as printing the output?
- Why is bash errexit not behaving as expected in function calls?
- bash script loop through two variables in lock step
- Check if a file is executable
- When does command substitution spawn more subshells than the same commands in isolation?
- Rsync syntax error when run from bash script
- Reading lines from two files in one while loop
- How do I kill a backgrounded/detached ssh session?
- Creating tar file and naming by current date