1
1
Fork 0
mirror of https://github.com/docker-mailserver/docker-mailserver synced 2024-05-28 18:16:11 +02:00
docker-mailserver/target/bin/delmailuser
Jack Twilley 6d2d9dd738 Handle missing files more gracefully. (#265)
* Wrote functional tests for desired behavior.

Redoing the pull request, starting from current master.

The tests now fail where expected.

* Updated commands to handle missing files better.

The functional tests now pass.
2016-08-24 10:06:59 +02:00

19 lines
289 B
Bash
Executable File

#!/bin/bash
DATABASE=/tmp/docker-mailserver/postfix-accounts.cf
function usage {
echo "Usage: delmailuser <user@domain.tld>"
exit 1
}
if [ ! -z "$1" ]; then
USER=$1
if [ -f "$DATABASE" ]; then
ENTRIES=$(grep "$USER" -vi $DATABASE)
echo "$ENTRIES" > $DATABASE
fi
else
usage
fi