By default, Bash treats uninitialized variables the same way as Perl — they are blank strings. If you want them treated more like Python, you can issue the following command in your bash script:
set -u
You will then start seeing warning messages like the following:
./my_script.sh: line 419: FOO_BAR: unbound variable
Note that this mean you can’t check for the non-existence of environment variables with a simple [[ -z “$ENVIRONMENT_VARIABLE” ]]. Instead, you could do something like the following:
[[ $( set | grep "ENVIRONMENT_VARIABLE=" | wc -l ) -lt 1 ]]