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 should work:
function grep_search() { declare magic_variable_$1="$(ls | tail -1)" echo "$(tmpvar=magic_variable_$1 && echo ${!tmpvar})" } grep_search var # calling grep_search with argument "var"