From b5ef76bfa3f8c107ca2a2d14bd96562e5ffed096 Mon Sep 17 00:00:00 2001 From: deajan Date: Thu, 9 Feb 2017 12:45:27 +0100 Subject: [PATCH] Added optional separator for SetConfFileValues --- dev/ofunctions.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 38f94c0..bcfa359 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -2,8 +2,8 @@ #### OFUNCTIONS FULL SUBSET #### #### OFUNCTIONS MINI SUBSET #### -_OFUNCTIONS_VERSION=2.1-RC2 -_OFUNCTIONS_BUILD=2017020801 +_OFUNCTIONS_VERSION=2.1-RC2+dev +_OFUNCTIONS_BUILD=2017020901 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -1870,10 +1870,12 @@ function SetConfFileValue () { local file="${1}" local name="${2}" local value="${3}" + local separator="${4:-#}" if grep "^$name=" "$file" > /dev/null; then # Using -i.tmp for BSD compat - sed -i.tmp "s/^$name=.*/$name=$value/" "$file" + echo "sed -i.tmp \"s$separator^$name=.*$separator$name=$value$separator\" \"$file\"" + sed -i.tmp "s$separator^$name=.*$separator$name=$value$separator" "$file" rm -f "$file.tmp" Logger "Set [$name] to [$value] in config file [$file]." "DEBUG" else