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
Post a Comment