Bash echo all array members when array is referenced as a variable in a loop -


the "echo" below failing , retarded figure out why. trying echo of array members in loop.

#!/bin/bash foo=bar1,bar2 in ${foo//,/" "} declare -a ${i}='(null null null null)' echo ${i[*]} done 

thanks help!

try eval "echo \${$i[*]}"

why doing way? there easier , more direct way whatever ultimate goal is. if describe it, perhaps can avoid unnecessary complication.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -