From c794049d1913fc1a4d3c3d3ad1699f62b864f11c Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Tue, 27 Aug 2024 22:39:12 +0200 Subject: [PATCH] :bug: fix regex precedence (fix #1) --- clientmgmt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clientmgmt b/clientmgmt index a6d43b8..acda927 100755 --- a/clientmgmt +++ b/clientmgmt @@ -96,14 +96,14 @@ clientmgmt_add(){ # ask whether auto-detection should be used local answer="x" local first=0 - until [[ -z "$answer" || "$answer" =~ ^Y|y|N|n$ ]]; do + until [[ -z "$answer" || "$answer" =~ ^(Y|y|N|n)$ ]]; do [[ "$first" -le 0 ]] && first=1 || echo "Invalid answer '$answer'" read -ep "Auto-detect public IP-Address using icanhazip.com? [Y/n]: " answer done # maybe do auto-detection local public_ip="" - if [[ ! "$answer" =~ ^N|n$ ]]; then + if [[ ! "$answer" =~ ^(N|n)$ ]]; then local exit=0 local icanhazip icanhazip=$(wget -O - -q icanhazip.com) || exit=$? @@ -307,7 +307,7 @@ clientmgmt_askname(){ ## VALIDATE ## # check for reserved names - if [[ "$answer" =~ ^ca|server$ ]]; then + if [[ "$answer" =~ ^(ca|server)$ ]]; then log_error "Name is reserved for internal use: '$answer'" fi