help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Does declare -n support (associative) arrays?


From: Chet Ramey
Subject: Re: [Help-bash] Does declare -n support (associative) arrays?
Date: Thu, 13 Dec 2018 09:07:29 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 12/12/18 11:43 PM, Peng Yu wrote:

>   *The nameref attribute cannot be
> applied to array variables.*
> 
> I am not sure if I understand the last sentence correctly. It seems a
> reference to an array can be assigned. What does the last sentence
> mean? Thanks.

It means you can't apply the nameref attribute to an existing array
variable:

$ cat ./x6
declare -A foo
declare -n foo
$ ./bash ./x6
./x6: line 2: declare: foo: reference variable cannot be an array


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/



reply via email to

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