Skip to content
Snippets Groups Projects
Commit a06f0ec8 authored by Jérôme Charaoui's avatar Jérôme Charaoui
Browse files

[tests] Fix setconfig() and make more robust

parent 09bbf993
Branches
No related tags found
No related merge requests found
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment