I am confused about a bash script.
I have the following code:
function grep_search() { magic_way_to_define_magic_variable_$1=`ls | tail -1` e
This will work too
my_country_code="green" x="country" eval z='$'my_"$x"_code echo $z ## o/p: green
In your case
eval final_val='$'magic_way_to_define_magic_variable_"$1" echo $final_val