Skip to content

Instantly share code, notes, and snippets.

@ezarko
Created February 12, 2018 20:49
Show Gist options
  • Save ezarko/8dd7c831a5d8542e1d450f64387f3d15 to your computer and use it in GitHub Desktop.
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.
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