In order to declare an array of type int (or an integer array)
I first tried:

declare -ai -g foo=(1 2 xx 3)
echo "${foo[@]}"
1 2 xx 3   <---------incorrect

So then tried:


declare -ia -g foo=(1 2 xx 3) echo "${foo[@]}"
1 2 0 3  <---------correct!

It seems 'declare' is sensitive to the order of its options in an
undesirable way -- i.e. for typed arrays, the -i should be
allowed either before or after the -a (or -A for hashes).

That makes me wonder if the "-g" worked.
I.e. -- if "-g" after "-ia" works, and whether I need "-g -ia"
(or "-gia")

(GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu))

Reply via email to