fixed -gt

This commit is contained in:
Matthew Saunders Brown 2021-10-15 16:15:05 -07:00
parent 5531423ba0
commit 29e93d3971

View File

@ -49,14 +49,14 @@ fi
# get mbox id, which also verfies that email address exists
mbox_id=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT id FROM vm_mboxes WHERE domain_id='$domain_id' AND mbox='$mbox';"`
if [ -z $mbox_id ] ; then
if [[ -z $mbox_id ]]; then
# mbox does not exist, can't create alias
echo "ERROR: Address to Alias To ($email) does not exist."
exit 1
elif [ "$mbox_id" -gt '1' ] ; then
elif [[ $mbox_id -gt 0 ]]; then
# verified mbox, check for existing alias
existing_alias=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT vm_aliases.id FROM vm_aliases WHERE vm_aliases.alias='$alias' AND vm_aliases.mbox_id='$mbox_id';"`
if [ -z $existing_alias ]; then
if [[ -z $existing_alias ]]; then
# existing alias does not exist, add new one now
dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'INSERT INTO vm_aliases SET vm_aliases.alias=\"$alias\", vm_aliases.mbox_id=\"$mbox_id\";'"
eval $dbcmd