get content from variable whose name is taken from another variable
bash, eval, fastq, variables
Solution
Try:
$ extension=$(eval "echo \$${ARG}_ext")
Problem
I am doing some shell scripting. I use this construction for creating new variables: ``` eval ${ARG}_ext=fastq ``` which works pretty nice because then I can use those newly created variable directly like this: ``` $file_ext ``` Now I want to assign value to the variable called extension: ``` extension= ``` The assigned value should be one found in variable ${ARG}_ext. Please, how can i do that? I have tried ``` extension=eval ${ARG}_ext; ``` but this gives me name of the variable and I want its value. Thanks.