Created
January 18, 2018 02:04
-
-
Save rankun203/9bc36db2fd90240055727b61e0be7360 to your computer and use it in GitHub Desktop.
Ensure environment is exist and empty
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
#!/usr/bin/env bash | |
# Functions -------- | |
ensure_env () { | |
ENV_NAME="$1" | |
ENV_VAL=${!ENV_NAME} | |
if [[ -z "${ENV_VAL}" ]]; then | |
echo "${ENV_NAME} does not exists, exiting." | |
exit | |
else | |
echo "$ENV_NAME = ${ENV_VAL}" | |
fi | |
} | |
# END Functions ---- | |
# Init ------------- | |
ensure_env GIT_BRANCH | |
ensure_env GIT_REPO_DIR | |
ensure_env GIT_REPO | |
ensure_env GIT_NAME | |
ensure_env GIT_EMAIL | |
# END Init --------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment