Can I get rid of eval
here? I\'m trying to set $current_database
with the appropriate variable determined by user input (country and action)
Doesn't
current_database=${final_${country}_${action}_path}
do what you want?
Edit: No, it does not. Parameter expansion works only on one word (for the parameter name), and $
is not allowed in a word. It would be possible to use nested parameter expansion in the other parts of the more complicated versions (with limits, replacement, default value etc.), though, which is why the several expansion variants are listed here (which fooled me first) (emphasis by me):
When braces are used, the matching ending brace is the first ‘}’ not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion.
Sorry. Looks like eval and arrays are your best bet, then.