Skip to content

Instantly share code, notes, and snippets.

@douglascayers
Created August 17, 2019 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save douglascayers/af7f791889662633904628ec20e00398 to your computer and use it in GitHub Desktop.
Save douglascayers/af7f791889662633904628ec20e00398 to your computer and use it in GitHub Desktop.
Bash: Read a properties file and set variables
# 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