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#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -