| Command | declare -p var |
[[ -v var ]] |
set +u; [[ $var ]]set -u; [[ ${var:-} ]] |
set -u; [[ $var ]] |
|---|---|---|---|---|
unset var |
FALSE ($?==1) | FALSE | FALSE | CRASH (unbound) |
declare var |
var |
FALSE | FALSE | CRASH (unbound) |
declare var= |
var="" |
TRUE | FALSE | FALSE |
declare var=1 |
var="1" |
TRUE | TRUE | TRUE |
Last active
December 16, 2025 18:06
-
-
Save colemar/cef6c8c2b13b1da50338d1ce934ee591 to your computer and use it in GitHub Desktop.
Bash Variable States Matrix
Author
colemar
commented
Dec 16, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment