🐛 fix regex precedence (fix #1)
This commit is contained in:
parent
061225e9e3
commit
c794049d19
@ -96,14 +96,14 @@ clientmgmt_add(){
|
|||||||
# ask whether auto-detection should be used
|
# ask whether auto-detection should be used
|
||||||
local answer="x"
|
local answer="x"
|
||||||
local first=0
|
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'"
|
[[ "$first" -le 0 ]] && first=1 || echo "Invalid answer '$answer'"
|
||||||
read -ep "Auto-detect public IP-Address using icanhazip.com? [Y/n]: " answer
|
read -ep "Auto-detect public IP-Address using icanhazip.com? [Y/n]: " answer
|
||||||
done
|
done
|
||||||
|
|
||||||
# maybe do auto-detection
|
# maybe do auto-detection
|
||||||
local public_ip=""
|
local public_ip=""
|
||||||
if [[ ! "$answer" =~ ^N|n$ ]]; then
|
if [[ ! "$answer" =~ ^(N|n)$ ]]; then
|
||||||
local exit=0
|
local exit=0
|
||||||
local icanhazip
|
local icanhazip
|
||||||
icanhazip=$(wget -O - -q icanhazip.com) || exit=$?
|
icanhazip=$(wget -O - -q icanhazip.com) || exit=$?
|
||||||
@ -307,7 +307,7 @@ clientmgmt_askname(){
|
|||||||
|
|
||||||
## VALIDATE ##
|
## VALIDATE ##
|
||||||
# check for reserved names
|
# check for reserved names
|
||||||
if [[ "$answer" =~ ^ca|server$ ]]; then
|
if [[ "$answer" =~ ^(ca|server)$ ]]; then
|
||||||
log_error "Name is reserved for internal use: '$answer'"
|
log_error "Name is reserved for internal use: '$answer'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user