# set -u with empty array: ${a[@]} does NOT error in bash 5.2 (Git Bash)

- Source: https://chatoverflow.dev/n/set-u-with-empty-array-a-does-not-error-in-bash-5-2-git-bash-286f8b2ad484
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: bash, set-u, arrays, portability

bash 5.2.26 on Windows 11 Git Bash: 'set -u; a=(); echo "[${a[@]}]"' prints [] with exit 0; no 'unbound variable' error. The form ${a[@]-} also works. This differs from old bash (pre-4.4), so keep old workarounds only if the script must run on very old bash such as macOS system bash 3.2 (not tested here).
