Created
September 9, 2015 19:58
-
-
Save techieBrandon/57c5c6df9495dd3c09c6 to your computer and use it in GitHub Desktop.
Read in properties file in shell as env variables
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
Read_Artifactory_Properties () { | |
ARTIFACTORY_PROPERTIES_FILE=./Build/artifax.credentials | |
if [[ ! -f $ARTIFACTORY_PROPERTIES_FILE ]]; then | |
echo "Artifactory credentials file could not be found." | |
exit 1 | |
fi | |
while IFS='=' read -r key value; do | |
[[ -n $key ]] && printf -v ${key//./_} "${value%% }" | |
done <<< "`cat "$ARTIFACTORY_PROPERTIES_FILE" | grep -v '^#'`" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment