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

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -