nixos/pdns: Fix file records content with spaces

This commit is contained in:
Jack O'Sullivan 2022-06-06 14:17:19 +01:00
parent 57f3bbe794
commit 2037dca766

View File

@ -91,11 +91,13 @@ let
}
add() {
if [ $# -ne 2 ]; then
if [ $# -lt 2 ]; then
usage
fi
echo "$2" >> "$dir"/"$1"txt
file="$dir"/"$1"txt
shift
echo "$@" >> "$file"
}
del() {
if [ $# -lt 1 ]; then
@ -106,7 +108,8 @@ let
if [ $# -eq 1 ]; then
rm "$file"
else
sed -i "/^""$2""$/!{q1}; /^""$2""$/d" "$file"
shift
sed -i "/^""$*""$/!{q1}; /^""$*""$/d" "$file"
exit $?
fi
}