From 3204bf3500702a5e2b99fc0bf9f28c01edae5960 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 11 Feb 2021 16:20:40 -0800 Subject: [PATCH] minor code cleanup --- bin/vmail-mboxes-add.sh | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/bin/vmail-mboxes-add.sh b/bin/vmail-mboxes-add.sh index 6425b88..538ae38 100755 --- a/bin/vmail-mboxes-add.sh +++ b/bin/vmail-mboxes-add.sh @@ -17,10 +17,31 @@ help() echo "" echo " -h Print this help." echo " -q QUOTA Set mailbox quota in GB, otherwise default for this domain is used. NULL means no limit." - echo " -s STATUS 1 for enabled, 0 for disabled." + echo " -s STATUS 1 for enabled, 0 for disabled. Default is in db structure and is normally set to 1." exit } +# set any options that were passed +while getopts "hq:s:" opt; do + case "${opt}" in + h ) + help + exit;; + q ) + quota=${OPTARG} + ;; + s ) + status=${OPTARG} + ;; + \? ) + echo "Invalid option: $OPTARG" 1>&2 + exit;; + : ) + echo "Invalid option: $OPTARG requires an argument" 1>&2 + exit;; + esac +done + # check for and set email address, local part & domain, password if [ -n "$2" ]; then if [ $1 == "-h" ] || [ $2 == "-h" ]; then @@ -52,27 +73,6 @@ else help fi -# set any options that were passed -while getopts "hq:s:" opt; do - case "${opt}" in - h ) - help - exit;; - q ) - quota=${OPTARG} - ;; - s ) - status=${OPTARG} - ;; - \? ) - echo "Invalid option: $OPTARG" 1>&2 - exit;; - : ) - echo "Invalid option: $OPTARG requires an argument" 1>&2 - exit;; - esac -done - # get domain_id (and thus check if domain already exists) domain_id=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT id from vm_domains WHERE domain='$domain';"` if [ -z $domain_id ] ; then