Bash indirect array addressing? -


suppose have bash arrays:

a1=(apple trees) a2=(building blocks) a3=(color television) 

and index j=2, how array contents of a2?

i've found resolution, can done by:

$ aref=a$j $ echo ${!aref} building $ aref=a$j[1] $ echo ${!aref} blocks $ aref=a$j[@] $ echo "${!aref}" building blocks 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -