This is not a bug. This is due to not understanding two aspects of bash:
1) $arrname is the same as ${arrname[0]} (not the "first" element, as what you seem to imply). Bash arrays are sparse, so you can define the element at index 1, without having an element at 0. 2) unset and empty is not the same. With :+ you're testing emptiness. With + you can test if a parameter is set. If your aim is to know if a certain array is defined, use: dualbus@yaqui ~ % bash -c 'a=(); declare -p -- b 2>/dev/null >&2; echo $?' 1 dualbus@yaqui ~ % bash -c 'a=(); declare -p -- a 2>/dev/null >&2; echo $?' 0 dualbus@yaqui ~ % bash -c 'a=(1); declare -p -- a 2>/dev/null >&2; echo $?' 0 -- Eduardo Bustamante https://dualbus.me/