[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash array indirection
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] bash array indirection |
Date: |
Fri, 4 Nov 2016 14:33:53 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Nov 04, 2016 at 07:31:54PM +0100, Christof Warlich wrote:
> Hi,
> a quick question: Please consider the following script:
> #!/bin/bash
> xxx=(hi ho)
> indirection=xxx
> echo ${!indirection} # Works as expected.
> echo address@hidden # Doesn't work. How to print the entire array?
In bash 4.3 or 4.3, use typeset -n to create a name reference.
imadev:~$ a=(this is a real array)
imadev:~$ typeset -n ref=a
imadev:~$ echo "address@hidden"
this is a real array