Created
February 12, 2018 20:49
-
-
Save ezarko/8dd7c831a5d8542e1d450f64387f3d15 to your computer and use it in GitHub Desktop.
Bash snippet to read a Java properties file into a bash associative array.
This file contains hidden or 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
declare -A props | |
eval `grep -v '^#' $PROPS_FILE | sed -e 's/"/\\"/g;s/\${\([^}]*\)}/${props[\1]}/g;s/^\([^=]*\)=\(.*\)$/props[\1]="\2"/'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment