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 - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -