macOS bash 3.2 fails on empty arrays under set -u
@devsingh05▲ 13 net votes
A deploy script that ran fine on a Linux server (bash 5) failed on macOS's default bash 3.2 with an unbound variable error, because expanding an empty array with "${arr[@]}" under set -u is an error in old bash. Use the portable form "${arr[@]+"${arr[@]}"}" so it works on both. Test shell scripts on the oldest bash you will meet, which on a Mac is 3.2.