fix type cvs -> csv

This commit is contained in:
Matthew Saunders Brown 2023-11-27 09:13:59 -08:00
parent 20bf1743c0
commit b263a75471
8 changed files with 20 additions and 20 deletions

View File

@ -20,7 +20,7 @@ help()
echo " -a Return info for specific alias." echo " -a Return info for specific alias."
echo " -e Return all aliases for specified email address." echo " -e Return all aliases for specified email address."
echo " -d Return all aliases for specified domain." echo " -d Return all aliases for specified domain."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo " -t Use tabs instead of tables for output, do not display column headers." echo " -t Use tabs instead of tables for output, do not display column headers."
echo "" echo ""
echo " Search term is optional. If nothing specified all aliases for all email acccounts for all domains will be returned." echo " Search term is optional. If nothing specified all aliases for all email acccounts for all domains will be returned."
@ -61,4 +61,4 @@ fi
dbquery="$dbquery ORDER BY domain, mbox, alias;"; dbquery="$dbquery ORDER BY domain, mbox, alias;";
# execute mysql query # execute mysql query
eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv

View File

@ -19,7 +19,7 @@ help()
echo " -h Print this help." echo " -h Print this help."
echo " -e <email> Email address to get autresonder for." echo " -e <email> Email address to get autresonder for."
echo " -d <domain> Domain to get all autoresponders for." echo " -d <domain> Domain to get all autoresponders for."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo " -t Use tabs instead of tables for output, do not display column headers." echo " -t Use tabs instead of tables for output, do not display column headers."
echo "" echo ""
echo " Search term is optional. If nothing specified all forwards for all email acccounts for all domains will be returned." echo " Search term is optional. If nothing specified all forwards for all email acccounts for all domains will be returned."
@ -53,4 +53,4 @@ fi
# sort results # sort results
dbquery="$dbquery ORDER BY domain, mbox" dbquery="$dbquery ORDER BY domain, mbox"
# execute mysql query # execute mysql query
eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv

View File

@ -17,7 +17,7 @@ help()
echo "usage: $thisfilename [-c] [-h]" echo "usage: $thisfilename [-c] [-h]"
echo "" echo ""
echo " -h Print this help." echo " -h Print this help."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo echo
echo " Returns defaults configured in the vm_domains table schema." echo " Returns defaults configured in the vm_domains table schema."
exit exit
@ -30,25 +30,25 @@ dbcmdopts="-s -N -e"
# get "status" default # get "status" default
dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'status'" dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'status'"
status=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs` status=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv`
# get "mbox_limit" default # get "mbox_limit" default
dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_limit'" dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_limit'"
mbox_limit=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs` mbox_limit=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv`
# get "mbox_quota_default" default # get "mbox_quota_default" default
dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_quota_default'" dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_quota_default'"
mbox_quota_default=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs` mbox_quota_default=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv`
# get "mbox_ratelimit_default" default # get "mbox_ratelimit_default" default
dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_ratelimit_default'" dbquery="SELECT COLUMN_DEFAULT FROM information_schema.columns WHERE TABLE_SCHEMA = 'vmail' AND TABLE_NAME = 'vm_domains' AND COLUMN_NAME = 'mbox_ratelimit_default'"
mbox_ratelimit_default=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs` mbox_ratelimit_default=`eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv`
# create newline var # create newline var
NL=$'\n' NL=$'\n'
output="status mbox_limit mbox_quota_default mbox_ratelimit_default${NL}$status $mbox_limit $mbox_quota_default $mbox_ratelimit_default" output="status mbox_limit mbox_quota_default mbox_ratelimit_default${NL}$status $mbox_limit $mbox_quota_default $mbox_ratelimit_default"
if [[ $cvs ]]; then if [[ $csv ]]; then
echo "$output" | tr " " "," echo "$output" | tr " " ","
else else
echo "$output" | column -t echo "$output" | column -t

View File

@ -18,7 +18,7 @@ help()
echo "" echo ""
echo " -h Print this help." echo " -h Print this help."
echo " -d Domain name to get DKIM info for." echo " -d Domain name to get DKIM info for."
echo " -c CVS - Output in cvs format, instead of tabbed table." echo " -c CSV - Output in csv format, instead of tabbed table."
echo "" echo ""
exit exit
} }
@ -49,7 +49,7 @@ if [[ ${#domains[@]} > 0 ]]; then
dkim=`cat /etc/ssl/dkim/$domain.dkim` dkim=`cat /etc/ssl/dkim/$domain.dkim`
output="$output${NL}$domain $selector $dkim" output="$output${NL}$domain $selector $dkim"
done done
if [[ $cvs ]]; then if [[ $csv ]]; then
echo "$output" | tr " " "," echo "$output" | tr " " ","
else else
echo "$output" | column -t echo "$output" | column -t

View File

@ -19,7 +19,7 @@ help()
echo " -h Print this help." echo " -h Print this help."
echo " -d Domain to be queried." echo " -d Domain to be queried."
echo " -g Glob - Wildcard search instead of specific domain search." echo " -g Glob - Wildcard search instead of specific domain search."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo " -t Use tabs instead of tables for output, do not display column headers." echo " -t Use tabs instead of tables for output, do not display column headers."
echo "" echo ""
echo " Domain/Glob is optional. If nothing specified all domains will be queried." echo " Domain/Glob is optional. If nothing specified all domains will be queried."
@ -49,4 +49,4 @@ fi
dbquery="$dbquery ORDER BY domain" dbquery="$dbquery ORDER BY domain"
# execute mysql query # execute mysql query
eval $dbcmd $dbcmdopts "\"$dbquery;\"" $cvs eval $dbcmd $dbcmdopts "\"$dbquery;\"" $csv

View File

@ -20,7 +20,7 @@ help()
echo " -e <email> Email address to get forwarding for." echo " -e <email> Email address to get forwarding for."
echo " -f <forward> Return info for specific forward." echo " -f <forward> Return info for specific forward."
echo " -d <domain> Get all forwards for specified domain." echo " -d <domain> Get all forwards for specified domain."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo " -t Use tabs instead of tables for output, do not display column headers." echo " -t Use tabs instead of tables for output, do not display column headers."
echo "" echo ""
echo " Search term is optional. If nothing specified all forwards for all email acccounts for all domains will be returned." echo " Search term is optional. If nothing specified all forwards for all email acccounts for all domains will be returned."
@ -54,4 +54,4 @@ fi
dbquery="$dbquery ORDER BY domain, mbox, forward_to;"; dbquery="$dbquery ORDER BY domain, mbox, forward_to;";
# execute mysql query # execute mysql query
eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv

View File

@ -20,7 +20,7 @@ help()
echo " -m <mbox> Return all email accounts, accross all domains, with <mbox> for the local part." echo " -m <mbox> Return all email accounts, accross all domains, with <mbox> for the local part."
echo " -d <domain> Return all email accounts from specified domain." echo " -d <domain> Return all email accounts from specified domain."
echo " -e <email> Specific email address to search for." echo " -e <email> Specific email address to search for."
echo " -c Output in cvs format." echo " -c Output in csv format."
echo " -t Use tabs instead of tables for output, do not display column headers." echo " -t Use tabs instead of tables for output, do not display column headers."
echo " -v Include encrypt password in output." echo " -v Include encrypt password in output."
echo "" echo ""
@ -66,4 +66,4 @@ fi
dbquery="$dbquery ORDER BY domain, mbox;"; dbquery="$dbquery ORDER BY domain, mbox;";
# execute mysql query # execute mysql query
eval $dbcmd $dbcmdopts "\"$dbquery\"" $cvs eval $dbcmd $dbcmdopts "\"$dbquery\"" $csv

View File

@ -111,8 +111,8 @@ function vmail:getoptions () {
b ) # body - Body for Autoresponder emails b ) # body - Body for Autoresponder emails
body="${OPTARG}" body="${OPTARG}"
;; ;;
c ) # cvs - output in cvs format c ) # csv - output in csv format
cvs="| sed 's/\t/,/g'" csv="| sed 's/\t/,/g'"
;; ;;
d ) # domain name (virtualhost) to act on d ) # domain name (virtualhost) to act on
domain=${OPTARG,,} domain=${OPTARG,,}