It appears that using "declare" or "typeset" with the -p (print) flag will add a new declaration inside a function. Is this really desirable? It seems to reduce the usefulness of -p. Here's an example: declare -a xx xx=(an array) bug() { echo xx is \"${xx[@]}\" before \"declare -p xx\" echo 'declare -p xx:' declare -p xx echo xx is now \"${xx[@]}\" in bug echo '====' } bug echo 'declare -p xx outside bug:' declare -p xx Running this produces: xx is "an array" before "declare -p xx" declare -p xx: typeset xx='' xx is now "" in bug ==== declare -p xx outside bug: typeset -a xx xx=(an array)