1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 # tests with blank subscripts, indexed and associative
32 echo -n 1. ; a[ ]=10 ; typeset -p a ; a[0]=0
33 echo -n 2. ; a[" "]=11 ; typeset -p a ; a[0]=0
34 echo -n 3. ; a[$v]=12 ; typeset -p a ; a[0]=0
35 echo -n 4. ; a["$v"]=13 ; typeset -p a ; a[0]=0
39 echo -n 1. ; (( a[ ]=10 )); typeset -p a ; a[0]=0
40 echo -n 2. ; (( a[" "]=11 )); typeset -p a ; a[0]=0
41 echo -n 3. ; (( a[$v]=12 )); typeset -p a ; a[0]=0
42 echo -n 4. ; (( a["$v"]=13 )); typeset -p a ; a[0]=0
43 echo -n 5. ; let "a[ ]=10" ; typeset -p a ; a[0]=0
44 echo -n 6. ; let "a[\" \"]=11" ; typeset -p a ; a[0]=0
45 echo -n 7. ; let "a[$v]=12" ; typeset -p a ; a[0]=0
46 echo -n 8. ; let "a[\"$v\"]=13" ; typeset -p a ; a[0]=0
51 shopt -s assoc_expand_once
69 echo -n 1. ; a[ ]=10 ; typeset -p a ; a[0]=0
70 echo -n 2. ; a[" "]=11 ; typeset -p a ; a[0]=0
71 echo -n 3. ; a[$v]=12 ; typeset -p a ; a[0]=0
72 echo -n 4. ; a["$v"]=13 ; typeset -p a ; a[0]=0
76 echo -n 1. ; (( a[ ]=10 )); typeset -p a ; a[0]=0
77 echo -n 2. ; (( a[" "]=11 )); typeset -p a ; a[0]=0
78 echo -n 3. ; (( a[$v]=12 )); typeset -p a ; a[0]=0
79 echo -n 4. ; (( a["$v"]=13 )); typeset -p a ; a[0]=0
80 echo -n 5. ; let "a[ ]=10" ; typeset -p a ; a[0]=0
81 echo -n 6. ; let "a[\" \"]=11" ; typeset -p a ; a[0]=0
82 echo -n 7. ; let "a[$v]=12" ; typeset -p a ; a[0]=0
83 echo -n 8. ; let "a[\"$v\"]=13" ; typeset -p a ; a[0]=0