bug-bash
[Top][All Lists]
Advanced

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

Re: declare/local severely mishandle arrays with quoted -g/-A


From: Chet Ramey
Subject: Re: declare/local severely mishandle arrays with quoted -g/-A
Date: Thu, 1 Oct 2026 14:58:55 -0400
User-agent: Mozilla Thunderbird

On 9/28/26 4:52 PM, collectthis@proton.me wrote:

My point was to show the result of missing the second -g:

   declare -r arr
   declare -ai arr=([0]="1" [1]="2" [2]="3")

Which is not what a user would intend, to illustrate the silliness of avoiding
the single command form of declare.

You don't have to avoid it if you can't. What you can't do is actively
defeat the heuristics the shell uses to detect what is going on.


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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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