On 11/26/2012 10:45 PM, Tim Friske wrote:
Hi folks,
Hi
I execute the following code in Bash version "GNU bash, Version 4.2.39(1)-release (x86_64-redhat-linux-gnu)": function foobar { declare -rgA FOOBAR=([foo]=bar) } foobar declare -p FOOBAR # Output: declare -Ar FOOBAR='()'
I think there should be also -g but it is not
Why doesn't Bash initialize FOOBAR with ([foo]=bar) according to declare -p? The same declaration works outside of a function, e.g. declare -rgA FOOBAR=([foo]=bar) declare -p FOOBAR # Output: declare -Ar FOOBAR='([foo]="bar" )' Similarly the following code but without FOOBAR being read-only works: function foobar { declare -gA FOOBAR FOOBAR=([foo]=bar) } foobar declare -p FOOBAR # Output: declare -A FOOBAR='([foo]="bar" )' Is this a bug or feature? Cheers, Tim BTW: I couldn't find a "bashbug" RPM package in the Fedora 17 repositories; that's why I wrote this formless mail. Sorry for that.
/usr/bin/bashbug-64 I will try to add symlink or something. Thanks
-- `~~~~°< C92A E44E CC19 58E2 FA35 4048 2217 3C6E 0338 83FC