1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Added optional separator for SetConfFileValues

This commit is contained in:
deajan 2017-02-09 12:45:27 +01:00
parent 7a930c9aef
commit b5ef76bfa3

View File

@ -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