#! /bin/bash # shellcheck source=../scripts/helpers/index.sh source /usr/local/bin/helpers/index.sh function _main { [[ ${1:-} == 'help' ]] && { __usage ; exit 0 ; } # Validate Parameters: [[ -z ${*} ]] && { __usage ; _exit_with_error 'No account specified' ; } # Actual command to perform: for MAIL_ACCOUNT in "${@}" do _manage_accounts_dovecotmaster_delete "${MAIL_ACCOUNT}" \ || _exit_with_error "'${MAIL_ACCOUNT}' could not be deleted" done } function __usage { printf '%s' "${PURPLE}deldovecotmasteruser${RED}(${YELLOW}8${RED}) ${ORANGE}USAGE${RESET} ./setup.sh dovecot-master del [ ${RED}...${RESET} ] ${ORANGE}OPTIONS${RESET} ${BLUE}Generic Program Information${RESET} help Print the usage information. ${ORANGE}DESCRIPTION${RESET} Delete a dovecot-master account. ${ORANGE}EXAMPLES${RESET} ${LWHITE}./setup.sh dovecot-master del admin${RESET} Delete the dovecot-master account 'admin'. ${LWHITE}./setup.sh dovecot-master del admin extra-admin${RESET} Delete the two dovecot-master accounts requested. ${ORANGE}EXIT STATUS${RESET} Exit status is 0 if command was successful. If wrong arguments are provided or arguments contain errors, the script will exit early with exit status 1. " } _main "${@}"