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 () {
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
h ) # display help and exit
help
@ -70,7 +70,7 @@ function vhost:getoptions () {
domain=${OPTARG,,}
if ! vhost::validate_domain $domain; then
echo "ERROR: $domain is not a valid domain name."
exit
exit 1
fi
;;
i ) # User ID (UID) for new user
@ -105,7 +105,7 @@ function vhost:getoptions () {
w ) # write - store data in file
write=${OPTARG}
if [[ $write != "0" ]] && [[ $write != "1" ]]; then
echo "ERROR: Invalid write setting: -j $write"
echo "ERROR: Invalid write setting: -w $write"
exit 1
fi
;;