mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-20 00:50:47 +02:00
change expansion for key-value pair compound assignment to associative arrays to split all words before identifying keys and values; controlled by a new shopt option: kvpair_split, enabled by default; new `loadassoc' loadable builtin to load an associative array from a set of key-value arguments
This commit is contained in:
+1
-1
@@ -515,7 +515,7 @@ declare -a e=([0]="Darwin")
|
||||
declare -A a=([0]="a b" )
|
||||
declare -A b=([0]="/scratch/bash" )
|
||||
declare -A c=([1]="2" )
|
||||
declare -A d=(["a b"]="" )
|
||||
declare -A d=([a]="b" )
|
||||
declare -A e=([Darwin]="" )
|
||||
array20.sub
|
||||
a+b+c
|
||||
|
||||
+9
-9
@@ -277,20 +277,20 @@ declare -Arx foo=([two]="2" [three]="3" [one]="1" )
|
||||
assoc12.sub
|
||||
declare -A v1=(["1 2"]="3" )
|
||||
declare -A v2=(["1 2"]="3" )
|
||||
declare -A v3=(["1 2"]="3" )
|
||||
declare -A v3=([3]="" [1]="2" )
|
||||
declare -A v1=(["1 2"]="3 4 5" )
|
||||
declare -A v2=(["1 2"]="3 4 5" )
|
||||
declare -A v3=([5]="" [3]="4" [1]="2" )
|
||||
declare -A v1=(["1 2"]="3 4 5" )
|
||||
declare -A v2=(["1 2"]="3 4 5" )
|
||||
declare -A v3=([4]="5" ["1 2"]="3" )
|
||||
declare -A v1=(["1 2"]="3 4 5" )
|
||||
declare -A v2=(["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" )
|
||||
declare -A v1=(["1 2"]="3 4 5" )
|
||||
declare -A v2=(["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" )
|
||||
declare -A v1=(["1 2"]="3 4 5" )
|
||||
declare -A v2=(["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" )
|
||||
declare -A v1=(["20 40 80"]="xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v1=([80]="xtra" ["1 2"]="3 4 5" [20]="40" )
|
||||
declare -A v2=(["20 40 80"]="xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="xtra" )
|
||||
declare -A v1=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v1=([80]="xtra" ["20 40 80"]="new xtra" ["1 2"]="3 4 5" [20]="40" )
|
||||
declare -A v2=(["20 40 80"]="new xtra" ["1 2"]="3 4 5" )
|
||||
declare -A v3=(["1 2"]="3 4 5" ["\$xtra"]="new xtra" )
|
||||
assoc13.sub
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ func
|
||||
loaddict()
|
||||
{
|
||||
dict=( '"' dquote '`' bquote "'" squote '\' bslash)
|
||||
dict+=( '$' dol @ at * star \{ lbrace \} rbrace ? quest)
|
||||
dict+=( '$' dol @ at \* star \{ lbrace \} rbrace \? quest)
|
||||
|
||||
declare -p dict
|
||||
echo dict=\( ${dict[@]@K} \)
|
||||
|
||||
@@ -211,6 +211,7 @@ hostcomplete
|
||||
huponexit
|
||||
inherit_errexit
|
||||
interactive_comments
|
||||
kvpair_split
|
||||
lastpipe
|
||||
lithist
|
||||
localvar_inherit
|
||||
|
||||
@@ -73,9 +73,9 @@ this-bash this-bash
|
||||
$- for -c includes c
|
||||
invocation1.sub
|
||||
bash: line 0: badopt: invalid shell option name
|
||||
checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
checkhash:checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:kvpair_split:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
checkhash:checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:kvpair_split:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:kvpair_split:patsub_replacement:progcomp:promptvars:sourcepath
|
||||
./invocation1.sub: line 40: BASHOPTS: readonly variable
|
||||
invocation2.sub
|
||||
braceexpand:hashall:interactive-comments
|
||||
|
||||
@@ -40,6 +40,7 @@ shopt -s hostcomplete
|
||||
shopt -u huponexit
|
||||
shopt -u inherit_errexit
|
||||
shopt -s interactive_comments
|
||||
shopt -s kvpair_split
|
||||
shopt -u lastpipe
|
||||
shopt -u lithist
|
||||
shopt -u localvar_inherit
|
||||
@@ -75,6 +76,7 @@ shopt -s globasciiranges
|
||||
shopt -s globskipdots
|
||||
shopt -s hostcomplete
|
||||
shopt -s interactive_comments
|
||||
shopt -s kvpair_split
|
||||
shopt -s patsub_replacement
|
||||
shopt -s progcomp
|
||||
shopt -s promptvars
|
||||
@@ -310,5 +312,9 @@ xtrace off
|
||||
--
|
||||
./shopt.tests: line 106: shopt: xyz1: invalid shell option name
|
||||
./shopt.tests: line 107: shopt: xyz1: invalid option name
|
||||
40c40
|
||||
< kvpair_split off
|
||||
---
|
||||
> kvpair_split on
|
||||
expand_aliases on
|
||||
expand_aliases on
|
||||
|
||||
Reference in New Issue
Block a user