mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Merge pull request #1573 from casperklein/patch-2
addalias: check if two arguments are given
This commit is contained in:
commit
26cc0c49ca
|
@ -18,7 +18,8 @@ escape() {
|
|||
echo "${1//./\\.}"
|
||||
}
|
||||
|
||||
[ -z "$EMAIL" ] && { usage; errex "no email specified"; }
|
||||
[ -z "$EMAIL" ] && { usage; errex "Error: No alias specified"; }
|
||||
[ -z "$RECIPIENT" ] && { usage; errex "Error: No recipient specified"; }
|
||||
|
||||
grep -qi "^$(escape $EMAIL)[a-zA-Z@.\ ]*$(escape $RECIPIENT)" $DATABASE 2>/dev/null &&
|
||||
errex "Alias \"$EMAIL $RECIPIENT\" already exists"
|
||||
|
|
|
@ -18,7 +18,9 @@ escape() {
|
|||
echo "${1//./\\.}"
|
||||
}
|
||||
|
||||
[ -z "$EMAIL" ] || [ -z "$RECIPIENT" ] && { usage; errex "No email specifed"; }
|
||||
[ -z "$EMAIL" ] && { usage; errex "Error: No alias specified"; }
|
||||
[ -z "$RECIPIENT" ] && { usage; errex "Error: No recipient specified"; }
|
||||
|
||||
[ -s "$DATABASE" ] || exit 0
|
||||
|
||||
#CNT=$(grep "^$EMAIL" $DATABASE | wc -w | awk '{print $1}')
|
||||
|
|
|
@ -7,7 +7,7 @@ errex() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
[ -f $DATABASE ] || errex "No postfix-virtual.cf file"
|
||||
[ -s $DATABASE ] || errex "Empty postfix-virtual.cf - no aliases have been added"
|
||||
[ -f $DATABASE ] || errex "Error: No postfix-virtual.cf file"
|
||||
[ -s $DATABASE ] || errex "Error: Empty postfix-virtual.cf - no aliases have been added"
|
||||
|
||||
(grep -v "^\s*$\|^\s*\#" $DATABASE || true)
|
||||
|
|
Loading…
Reference in a new issue