Check if second argument is given

This commit is contained in:
Casper 2020-07-19 21:21:01 +02:00 committed by GitHub
parent f206ad7ee1
commit 7c0998f7fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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"