Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
syntax:arrays [2013/04/14 14:27]
thebonsai Don't tread version 4 special - it has been around for a long time now
syntax:arrays [2013/07/21 02:04] (current)
ormaaj [Bugs] More bugs fixed!!
Line 340: Line 340:
 ==== Bugs ==== ==== Bugs ====
  
-  * Bash 4.2.* and earlier considers each chunk of a compound assignment, including the subscript for globbing. The subscript part is considered quoted, but any unquoted glob characters on the right-hand side of the ''​[...]=''​ will be clumped with the subscript and counted as a glob. Therefore, you must quote anything on the right of the ''​=''​ sign.  This is fixed in 4.3, so that each subscript assignment statement is expanded following the same rules as an ordinary assignment. This also works correctly in ksh93. <​code>​+  ​* **Fixed in 4.3** Bash 4.2.* and earlier considers each chunk of a compound assignment, including the subscript for globbing. The subscript part is considered quoted, but any unquoted glob characters on the right-hand side of the ''​[...]=''​ will be clumped with the subscript and counted as a glob. Therefore, you must quote anything on the right of the ''​=''​ sign.  This is fixed in 4.3, so that each subscript assignment statement is expanded following the same rules as an ordinary assignment. This also works correctly in ksh93. <​code>​
 $ touch '​[1]=a';​ bash -c '​a=([1]=*);​ echo "​${a[@]}"'​ $ touch '​[1]=a';​ bash -c '​a=([1]=*);​ echo "​${a[@]}"'​
 [1]=a [1]=a
Line 347: Line 347:
 1=a 1=a
 </​code>​ </​code>​
-  * In addition to the above globbing issue, assignments preceding "​declare"​ have an additional effect on brace and pathname expansion. <​code>​+  ​* **Fixed in 4.3** In addition to the above globbing issue, assignments preceding "​declare"​ have an additional effect on brace and pathname expansion. <​code>​
 $ set -x; foo=bar declare arr=( {1..10} ) $ set -x; foo=bar declare arr=( {1..10} )
 + foo=bar + foo=bar
Line 359: Line 359:
 + declare xy=foo + declare xy=foo
 </​code>​ Each word (the entire assignment) is subject to globbing and brace expansion. This appears to trigger the same strange expansion mode as ''​let'',​ ''​eval'',​ other declaration commands, and maybe more.  </​code>​ Each word (the entire assignment) is subject to globbing and brace expansion. This appears to trigger the same strange expansion mode as ''​let'',​ ''​eval'',​ other declaration commands, and maybe more. 
-  * Indirection combined with another modifier expands arrays to a single word. <​code>​+  ​* **Fixed in 4.3** Indirection combined with another modifier expands arrays to a single word. <​code>​
 $ a=({a..c}) b=a[@]; printf '<​%s>​ ' "​${!b}";​ echo; printf '<​%s>​ ' "​${!b/​%/​foo}";​ echo $ a=({a..c}) b=a[@]; printf '<​%s>​ ' "​${!b}";​ echo; printf '<​%s>​ ' "​${!b/​%/​foo}";​ echo
 <a> <b> <c> <a> <b> <c>
 <a b cfoo> <a b cfoo>
 </​code>​ </​code>​
-  * Process substitutions are evaluated within array indexes. Zsh and ksh don't do this in any arithmetic ​contextT. <​code> ​+  ​* **Fixed in 4.3** Process substitutions are evaluated within array indexes. Zsh and ksh don't do this in any arithmetic ​context. <​code> ​
 # print "​moo"​ # print "​moo"​
 dev=fd=1 _[1<​(echo moo >&​2)]= dev=fd=1 _[1<​(echo moo >&​2)]=