On 1/25/10 6:58 AM, Mart Frauenlob wrote: > As i came up with this i have to go further ;) ,so i installed bash > 4.1.2 and your new patch and ran tests again with it and 3.1.17, 4.0.35 > versions. > Patch seems to be working for return values of '${#arr...@]}'. > But ${!arr...@]} returns 0 on the declared but unassigned local variable > - which i think should be the NULL string.
You're right. > What worries me, is that v4.0.35 behaves weird with a local variable > declared, as ${#arr...@]} always returns 1 inside the fill() loop. Why does that worry you? This is what I posted the patch to change. > Also i noticed, that from bash 4 it looks like the declare builtin > reacts differently. `declare -p var' on a globally declared but > unassigned variable returns false, but for the same thing as a local > variable it returns: `declare -- var=""' (with true as exit status of > course). It should return "declare -- var" in the function when used with a local variable. The minor inconsistency is for two reasons: to shadow any global copy of the variable, since the normal behavior would be to ignore it and people expect `declare var' to create a local variable, and to save a reference to any other attributes, since users expect `declare -i var' to perform arithmetic evaluation on a variable when it's assigned a value. The problem with this is that it leads to other minor inconsistencies, two of which you found. These will be fixed in the next version of bash. Thanks for testing these details. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/