help-bash
[Top][All Lists]
Advanced

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

Re: How do we get state of a flag in set -o ...


From: alex xmb ratchev
Subject: Re: How do we get state of a flag in set -o ...
Date: Thu, 13 Jul 2023 16:11:30 +0200

On Wed, Jul 12, 2023, 4:19 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/11/23 6:11 PM, Kerin Millar wrote:
>
> > It is even true of variable expansion.
> >
> > $ declare -A map; str="two words"; map=( $str ); declare -p map
> > declare -A map=(["two words"]="" )
> >
> > It seems like a bug to me. It's certainly counter-intuitive. For indexed
> arrays, word splitting occurs. I see no particular reason for associative
> arrays to be a special case.
>
> You have it backwards. Word splitting doesn't happen on the rhs of an
> assignment statement. It happens for indexed arrays in this particular
> case because I did it for ksh compatibility (because the behavior of a list
> of words in a compound assignment to an indexed array was well-defined), so
> indexed arrays are the exception. Note that it doesn't take place for
> assignment words in a compound array assignment, making it even more of a
> special case.
>

no idea

Now that key-value pairs in compound assignments to associative arrays
> are well-defined, it might make sense to extend the associative array
> compound assignments to perform word splitting, but that's not backwards
> compatible, and the whole idea of key-value assignments is to mimic
> the semantics of ( [key]=value ... ).
>

no idea either

u / we can make more shopts or so
where the default is your_outdated_sh wanted
but there implent updates

.. var1 value1
is a type
[var1 / ${var@Q}]=value1
is another type
.. i find the first more logical , more sh "args" ,
the second be therefore older standard .. notice have to @Q to make it at
all

-- 
> ``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/
>
>


reply via email to

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