unquote quota in case of NULL

This commit is contained in:
Matthew Saunders Brown 2021-10-15 16:01:53 -07:00
parent 3302ae6dcc
commit 8cc3a8a109
2 changed files with 5 additions and 6 deletions

View File

@ -44,7 +44,7 @@ if [[ -n $quota ]]; then
# make quota uppercase in case it is set to NULL # make quota uppercase in case it is set to NULL
quota=`echo $quota | tr [:lower:] [:upper:]` quota=`echo $quota | tr [:lower:] [:upper:]`
if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then
dbset=" mbox_quota_default=\"$quota\"" dbset=" mbox_quota_default=$quota"
else else
echo "ERROR: quota (-q) must numeric or NULL" echo "ERROR: quota (-q) must numeric or NULL"
exit 1 exit 1
@ -59,7 +59,7 @@ if [[ -n $limit ]]; then
if [ ! -z "$dbset" ]; then if [ ! -z "$dbset" ]; then
dbset="$dbset," dbset="$dbset,"
fi fi
dbset="$dbset mbox_limit=\"$limit\"" dbset="$dbset mbox_limit=$limit"
else else
echo "ERROR: limit (-l) must numeric or NULL" echo "ERROR: limit (-l) must numeric or NULL"
exit 1 exit 1

View File

@ -47,7 +47,7 @@ if [ -n "$quota" ]; then
# make quota uppercase in case it is set to NULL # make quota uppercase in case it is set to NULL
quota=`echo $quota | tr [:lower:] [:upper:]` quota=`echo $quota | tr [:lower:] [:upper:]`
if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then if [[ "$quota" =~ ^[0-9]+$ ]] || [[ "$quota" == "NULL" ]]; then
dbset=" quota=\"$quota\"" dbset=" quota=$quota"
else else
echo "ERROR: quota (-q) must numeric or NULL" echo "ERROR: quota (-q) must numeric or NULL"
exit 1 exit 1
@ -74,9 +74,8 @@ fi
if [ -n "$dbset" ]; then if [ -n "$dbset" ]; then
# build query # build query
dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'UPDATE vm_mboxes SET $dbset WHERE mbox.id=\"$mbox_id\";'" dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'UPDATE vm_mboxes SET $dbset WHERE id=\"$mbox_id\";'"
# eval $dbcmd eval $dbcmd
echo $dbcmd
else else