Fix delmailuser error handling (#2181)

* Update delmailuser

* it's ok, when 'sed -i' leaves a file unchanged

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Casper 2021-09-14 14:07:29 +02:00 committed by GitHub
parent 2bc3e821fa
commit 54ee1e7567
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,7 +101,7 @@ do
if [[ -f ${DATABASE} ]] if [[ -f ${DATABASE} ]]
then then
if ! sed -i "/^${EMAIL}|/d" "${DATABASE}" if ! sedfile -i "/^${EMAIL}|/d" "${DATABASE}"
then then
echo "${UNESCAPED_EMAIL} couldn't be deleted in ${DATABASE}." >&2 echo "${UNESCAPED_EMAIL} couldn't be deleted in ${DATABASE}." >&2
ERROR=true ERROR=true
@ -126,7 +126,7 @@ do
# remove quota directives # remove quota directives
if [[ -f ${QUOTA_DATABASE} ]] if [[ -f ${QUOTA_DATABASE} ]]
then then
if ! sed -i -e "/^${EMAIL}:.*$/d" "${QUOTA_DATABASE}" if ! sedfile -i -e "/^${EMAIL}:.*$/d" "${QUOTA_DATABASE}"
then then
echo "Quota for ${UNESCAPED_EMAIL} couldn't be deleted in ${QUOTA_DATABASE}." >&2 echo "Quota for ${UNESCAPED_EMAIL} couldn't be deleted in ${QUOTA_DATABASE}." >&2
fi fi