In old bash versions, an array expansion ${arr[@]} of an empty array fails with "unbound variable" error
Workaround: write ${arr[@]+"${arr[@]}"}
https://stackoverflow.com/questions/7577052/unbound-variable-error-in-bash-when-expanding-empty-array
I know that bash is a disaster, but I still felt a WAT moment

Unbound variable error in bash when expanding empty array
I'm writing a bash script which has set -u, and I have a problem with empty array expansion: bash appears to treat an empty array as an unset variable during expansion:
$ set -u
$ arr=()
$ echo "f...
Stack OverflowI wish computers could search by substring