2 # The calls to egrep -v are to filter out builtin array variables that are
3 # automatically set and possibly contain values that vary.
16 x=${_ENV[(_$-=0)+(_=1)-_${-%%*i*}]}
25 # this should print out values, too
26 declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
49 a[4+5/2]="test expression"
54 readonly -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
55 declare -ar | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
57 declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
61 declare -a e[10]='(test)'
64 declare -a f='("${d[@]}")'
65 b=([0]=this [1]=is [2]=a [3]=test [4]="$PS1" [5]=$pass)
69 declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
82 d=([]=abcde [1]="test test" [*]=last [-65]=negative )
87 declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
96 # the prompt should not print when using a here doc
97 read -p "array test: " -a rv <<!
98 this is a test of read using arrays
101 echo ${rv[0]} ${rv[4]}
104 declare -a | egrep -v '(BASH_VERSINFO|PIPESTATUS)'
114 echo efgh | ( read x[1] ; echo ${x[1]} )
115 echo wxyz | ( declare -a x ; read x ; echo $x ; echo ${x[0]} )
117 # Make sure that arrays can be used to save the positional paramters verbatim
118 set -- a 'b c' d 'e f g' h
122 for z in "${ARGV[@]}"