Created
July 6, 2017 09:32
-
-
Save agirorn/5e92cb2f9d859959ba7ab3bd705a201c to your computer and use it in GitHub Desktop.
Bash: Check if variable is set.
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
#!/usr/bin/env bash | |
# Uncomment next line to test | |
# VARIABLE=10 | |
if [ -z ${VARIABLE+x} ]; then | |
echo "Variable \$VARIABLE is not set" | |
else | |
echo "Variable \$VARIABLE is set and has the value of => $VARIABLE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment