Skip to content

Instantly share code, notes, and snippets.

View ggtools's full-sized avatar

Christophe Labouisse ggtools

View GitHub Profile
@ggtools
ggtools / readIniSection.sh
Created January 29, 2012 00:06
Parse .ini file
# Reads a section of the ini file and put the results in variables prefixed by the supplied prefix.
readIniSection() {
local PREFIX="$1"
local SECTION="${2-main}"
# Neat way to parse the ini section from CONFIG_FILE
# shamelessly taken from http://www.tuxz.net/blog/
eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
-e 's/;.*$//' \
-e 's/[[:space:]]*$//' \