Bash, Concatenating 2 strings to reference a 3rd variable
- by Im Fine
I have a bash script I am having some issues with concatenating 2 variables to call a 3rd.
Here is a simplification of the script, but the syntax is eluding me after reading the docs.
server_list_all="server1 server2 server3";
var1 = "server";
var2 = "all";
echo $(($var1_list_$var2));
This is about as close as I get to the right answer, it acknowledges the string and tosses an error on tokenization.
syntax error in expression (error token is "server1 server2 server3....
Not really seeing anything in the docs for this, but it should be doable.
EDIT: Cleaned up a bit