Created
September 17, 2019 07:30
-
-
Save tonicebrian/fcdf1228e31735c12c6ffc9c978a522f to your computer and use it in GitHub Desktop.
Check for variables defined in bash script
This file contains 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
for var in MY_ENV_VAR_1 MY_ENV_VAR_2; do | |
if [[ -z "${!var:-}" ]]; | |
then | |
echo "You need to provide a value for env variable $var" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment