Created
August 17, 2019 03:23
-
-
Save douglascayers/af7f791889662633904628ec20e00398 to your computer and use it in GitHub Desktop.
Bash: Read a properties file and set 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 a property file line by line and | |
# set key=value pairs as bash variables | |
# https://stackoverflow.com/a/28831442/470818 | |
FILEPATH=$1 | |
while IFS='=' read -r k v; do | |
eval ${k}=${v} | |
done < $FILEPATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment