help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] bash array indirection


From: Christof Warlich
Subject: Re: [Help-bash] bash array indirection
Date: Fri, 4 Nov 2016 19:38:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Am 04.11.2016 um 19:33 schrieb Greg Wooledge:
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

Hi Greg,

that was quick, many thanks! :-)

Chris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]