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: Wed, 12 Jul 2023 00:03:14 +0200

>
>
> > ~ $ IFS=$' \t\n' ; ret() { declare -gA a=( $( set -o ) ) ; declare -p a
> ; }
> > ; sett() { declare -A m=( off + on - ) ; declare -ga args=( set ) ; for z
> > in ${!a[@]} ; do declare -n "v=a[$z]" "mm=m[$v]" ; echo args+= ${mm}o
> $z  ;
> > done ; echo set "${args[@]}" ; } ; ret
> >
> > i didnt try without declare but ill try
>
> Let's use a more conventional definition of simple.
>
> $ declare -A map=( two words ); declare -p map
> declare -A map=([two]="words" )
>
> $ declare -A map=( $(echo "two words") ); declare -p map
> declare -A map=(["two words"]="" )
>
> $ declare -A map=(); map=( $(echo "two words") ); declare -p map
> declare -A map=(["two words"]="" )
>
> This shows that the command substitution does not undergo a round of word
> splitting in the case of an associative array, which I also find
> surprising. I'm not sure whether it is intentional or not.
>

weird .. this is a big problem to me .. i swear i had such parsing going
for long
since -A a=( var1 arg1 ) was introduced somewhen ..

its like the worlds reverse
.. not the first time

=)

-- 
> Kerin Millar
>


reply via email to

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