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
An extra method that doesn't rely on which shell/bash version you have is by using envsubst. For example:
envsubst
newvar=$(echo '$magic_variable_'"${dynamic_part}" | envsubst)