Created
June 1, 2022 15:26
-
-
Save goddoe/77469e930348248ba6d72014354f853f to your computer and use it in GitHub Desktop.
right way to check var is unset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reference: https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash | |
| if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment