forked from ungleich-public/cdist
--regex to make __addifnosuchline more flexible
This commit is contained in:
parent
745cf47e43
commit
6d55d7ae82
2 changed files with 9 additions and 2 deletions
|
@ -26,12 +26,18 @@ else
|
|||
file="/$__object_id"
|
||||
fi
|
||||
|
||||
regex=$(cat "$__object/parameter/line")
|
||||
if [ -f "$__object/parameter/regex" ]; then
|
||||
regex=$(cat "$__object/parameter/regex")
|
||||
else
|
||||
wrap=$(cat "$__object/parameter/line")
|
||||
regex="^$wrap\$"
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
# sh -e is our environment, we know what we do,
|
||||
# skip error detection for now
|
||||
set +e
|
||||
grep -q "^$regex\$" "$file"
|
||||
grep -q "$regex" "$file"
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "NOTFOUND"
|
||||
else
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
file
|
||||
regex
|
||||
|
|
Loading…
Reference in a new issue