getopts fixes

This commit is contained in:
Matthew Saunders Brown 2023-05-10 15:23:54 -07:00
parent 8f191a2470
commit 05172002df

View File

@ -57,7 +57,7 @@ function vhost::validate_domain () {
function vhost:getoptions () { function vhost:getoptions () {
local OPTIND local OPTIND
while getopts "cd:i:m:o:p:u:jhnvwx:" opt ; do while getopts "cd:i:m:o:p:u:j:hnvw:x:" opt ; do
case "${opt}" in case "${opt}" in
h ) # display help and exit h ) # display help and exit
help help
@ -70,7 +70,7 @@ function vhost:getoptions () {
domain=${OPTARG,,} domain=${OPTARG,,}
if ! vhost::validate_domain $domain; then if ! vhost::validate_domain $domain; then
echo "ERROR: $domain is not a valid domain name." echo "ERROR: $domain is not a valid domain name."
exit exit 1
fi fi
;; ;;
i ) # User ID (UID) for new user i ) # User ID (UID) for new user
@ -105,7 +105,7 @@ function vhost:getoptions () {
w ) # write - store data in file w ) # write - store data in file
write=${OPTARG} write=${OPTARG}
if [[ $write != "0" ]] && [[ $write != "1" ]]; then if [[ $write != "0" ]] && [[ $write != "1" ]]; then
echo "ERROR: Invalid write setting: -j $write" echo "ERROR: Invalid write setting: -w $write"
exit 1 exit 1
fi fi
;; ;;