Multi-dimensional arrays in Bash -


i planning script manage pieces of linux systems , @ point of deciding if want use or .

i prefer bash script because commands easier, real deciding factor configuration. need able store multi-dimensional array in configuration file tell script itself. storing simple key=value pairs in config files easy enough bash, way can think of multi-dimensional array 2 layer parsing engine, like

array=&d1|v1;v2;v3&d2|v1;v2;v3 

but marshall/unmarshall code bear , far user friendly next poor sap has administer this. if can't in bash write configs xml file , write script in python.

is there easy way in bash?

thanks everyone.

bash not support multidimensional arrays, nor hashes, , seems want hash values arrays. solution not beautiful, solution xml file should better :

array=('d1=(v1 v2 v3)' 'd2=(v1 v2 v3)') elt in "${array[@]}";do eval $elt;done echo "d1 ${#d1[@]} ${d1[@]}" echo "d2 ${#d2[@]} ${d2[@]}" 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -