Yes, but don’t do that. Use an array instead.
If you still insist on doing it that way…
$ foo1=123
$ bar=foo1
$ echo "${!bar}"
123
More Related Contents:
- Why does shell ignore quoting characters in arguments passed to it through variables? [duplicate]
- Expansion of variables inside single quotes in a command in Bash
- How to check if a variable is set in Bash
- Capturing multiple line output into a Bash variable
- Brace expansion with variable? [duplicate]
- Bash – variable variables [duplicate]
- Why does a space in a variable assignment give an error in Bash? [duplicate]
- Set environment variables from file of key/value pairs
- What is the meaning of the ${0##…} syntax with variable, braces and hash character in bash?
- Using variables inside a bash heredoc
- How to remove a newline from a string in Bash
- What is the difference between “$@” and “$*” in Bash? [duplicate]
- Variable containing multiple args with quotes in Bash
- Bash script compare two date variables [duplicate]
- What is the difference between ${var}, “$var”, and “${var}” in the Bash shell?
- What is the exact meaning of IFS=$’\n’?
- Parsing variables from config file in Bash
- Bash variables with spaces
- Bash indirect variable referencing
- bash variable interpolation separate variables by a hyphen or underscore
- How to modify a global variable within a function in bash?
- bash background process modify global variable
- Bash script store command output into variable
- How to split one string into multiple variables in bash shell? [duplicate]
- sed replace with variable with multiple lines [duplicate]
- Divide two variables in bash
- Expand variables in sed
- bash piping prevents global variable assignment
- Left side of pipe is the subshell?
- Loop over array, preventing wildcard expansion (*)