bug-bash
[Top][All Lists]
Advanced

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

Re: How to initialize a read-only, global, associative array in Bash?


From: Chet Ramey
Subject: Re: How to initialize a read-only, global, associative array in Bash?
Date: Tue, 27 Nov 2012 15:02:07 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 11/27/12 8:34 AM, Roman Rakus wrote:
> On 11/26/2012 10:45 PM, Tim Friske wrote:
>> Hi folks,
> Hi
>>
>> I execute the following code in Bash version "GNU bash, Version
>> 4.2.39(1)-release (x86_64-redhat-linux-gnu)":
>>
>> function foobar {
>>    declare -rgA FOOBAR=([foo]=bar)
>> }
>> foobar
>> declare -p FOOBAR
>> # Output: declare -Ar FOOBAR='()'
> I think there should be also -g but it is not

No.  The -g option affects scoping at declaration time; it is not an
attribute.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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