Skip to content

Instantly share code, notes, and snippets.

@techieBrandon
Created September 9, 2015 19:58
Show Gist options
  • Save techieBrandon/57c5c6df9495dd3c09c6 to your computer and use it in GitHub Desktop.
Save techieBrandon/57c5c6df9495dd3c09c6 to your computer and use it in GitHub Desktop.
Read in properties file in shell as env variables
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