In the following example, I was expecting var2 not to be seen as an unbound variable after it was declared. Wouldn't it be more consistent with the treatment of var1 not to issue the unbound variable error in this case? What is the rationale behind the current behavior?
bash-3.2$ shopt -s -o nounset
bash-3.2$ declare var1
bash-3.2$ echo $var1
bash-3.2$ declare -a var2
bash-3.2$ echo $var2
bash: var2: unbound variable
bash-3.2$ echo ${va...@]}
bash: va...@]: unbound variable
--
Yorick
