diff --git a/install.sh b/install.sh index e2a637d43..ffa0479e0 100644 --- a/install.sh +++ b/install.sh @@ -679,7 +679,9 @@ ssl_cert_issue() { # get the port number for the standalone server local WebPort=80 prompt_or_default WebPort "Please choose which port to use (default is 80): " "80" XUI_ACME_HTTP_PORT - if [[ ${WebPort} -gt 65535 || ${WebPort} -lt 1 ]]; then + if [[ -z ${WebPort} ]]; then + WebPort=80 + elif [[ ! ${WebPort} =~ ^[1-9][0-9]*$ || ${WebPort} -gt 65535 ]]; then echo -e "${yellow}Your input ${WebPort} is invalid, will use default port 80.${plain}" WebPort=80 fi diff --git a/update.sh b/update.sh index f3efb8a0a..40910eaa3 100755 --- a/update.sh +++ b/update.sh @@ -498,7 +498,9 @@ ssl_cert_issue() { # get the port number for the standalone server local WebPort=80 read -rp "Please choose which port to use (default is 80): " WebPort - if [[ ${WebPort} -gt 65535 || ${WebPort} -lt 1 ]]; then + if [[ -z ${WebPort} ]]; then + WebPort=80 + elif [[ ! ${WebPort} =~ ^[1-9][0-9]*$ || ${WebPort} -gt 65535 ]]; then echo -e "${yellow}Your input ${WebPort} is invalid, will use default port 80.${plain}" WebPort=80 fi diff --git a/x-ui.sh b/x-ui.sh index 94e74198f..4125198c4 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -1838,7 +1838,9 @@ ssl_cert_issue() { # get the port number for the standalone server local WebPort=80 read -rp "Please choose which port to use (default is 80): " WebPort - if [[ ${WebPort} -gt 65535 || ${WebPort} -lt 1 ]]; then + if [[ -z ${WebPort} ]]; then + WebPort=80 + elif [[ ! ${WebPort} =~ ^[1-9][0-9]*$ || ${WebPort} -gt 65535 ]]; then LOGE "Your input ${WebPort} is invalid, will use default port 80." WebPort=80 fi