Don't combine sed options
Combining '-i -e' into '-ie' changes behaviour, don't do that Change-Id: Ice46c6b4f899b4c76f355cc88241dd33bc60f459
This commit is contained in:
parent
e509d9cde7
commit
afd472cb30
@ -419,7 +419,7 @@ function inicomment() {
|
|||||||
local file=$1
|
local file=$1
|
||||||
local section=$2
|
local section=$2
|
||||||
local option=$3
|
local option=$3
|
||||||
sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
|
sed -i -e "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
|
||||||
}
|
}
|
||||||
|
|
||||||
# Uncomment an option in an INI file
|
# Uncomment an option in an INI file
|
||||||
@ -428,7 +428,7 @@ function iniuncomment() {
|
|||||||
local file=$1
|
local file=$1
|
||||||
local section=$2
|
local section=$2
|
||||||
local option=$3
|
local option=$3
|
||||||
sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
|
sed -i -e "/^\[ *$section *\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -457,12 +457,12 @@ function iniset() {
|
|||||||
fi
|
fi
|
||||||
if [[ -z "$(iniget $file $section $option)" ]]; then
|
if [[ -z "$(iniget $file $section $option)" ]]; then
|
||||||
# Add it
|
# Add it
|
||||||
sed -ie "/^\[ *$section *\]/ a\\
|
sed -i -e "/^\[ *$section *\]/ a\\
|
||||||
$option = $value
|
$option = $value
|
||||||
" $file
|
" $file
|
||||||
else
|
else
|
||||||
# Replace it
|
# Replace it
|
||||||
sed -ie "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" $file
|
sed -i -e "/^\[ *$section *\]/,/^\[.*\]/ s|^\($option[ \t]*=[ \t]*\).*$|\1$value|" $file
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user