mirror of
https://0xacab.org/liberate/backupninja.git
synced 2024-11-09 20:32:38 +01:00
tests: Fix setconfig() and make more robust
This commit is contained in:
parent
57b2f217a8
commit
4dd6a0971d
@ -68,9 +68,9 @@ teardown() {
|
||||
}
|
||||
|
||||
setconfig() {
|
||||
if grep -q "$2 =" "${BATS_TMPDIR}/$1"; then
|
||||
sed -i "s/^$2.*/$2 = $3/" "${BATS_TMPDIR}/$1"
|
||||
if grep -qe "$2\s\+=" "${BATS_TMPDIR}/$1"; then
|
||||
sed -i "s/^$2\s\+=.*/$2 = $3/" "${BATS_TMPDIR}/$1"
|
||||
else
|
||||
echo "$2 = $3/" >> "${BATS_TMPDIR}/$1"
|
||||
echo "$2 = $3" >> "${BATS_TMPDIR}/$1"
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user