Last active
November 24, 2017 06:11
-
-
Save ephemerr/c31af6959187f2554ff52f9d227f2ef9 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
function get_setting_value { | |
declare SECTION=$1 | |
declare KEY=$2 | |
sed -nr '/\['$SECTION\]'/,/\[.*\]/{/'$KEY'/s/(.*)=(.*)/\2/p}' "$INI_FILE" | |
} | |
function set_setting_value { | |
declare SECTION=$1 | |
declare KEY=$2 | |
declare VALUE=$3 | |
sed -ri '/'$SECTION'/,/\[/ s/(\s*'$KEY'\s*=\s*).+/\1'$VALUE'/' "$INI_FILE" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment