mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Use perl instead of grep?
This commit is contained in:
parent
15037fa888
commit
85b3fef08d
1 changed files with 2 additions and 2 deletions
|
@ -66,11 +66,11 @@ HandleOther(){
|
|||
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
|
||||
|
||||
#check validity of domain
|
||||
validDomain=$(echo "${domain}" | grep -P '^(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b')
|
||||
validDomain=$(echo "${domain}" | perl -lne 'print $1 if /^(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
|
||||
if [ -z "${validDomain}" ]; then
|
||||
echo "::: $1 is not a valid argument or domain name"
|
||||
else
|
||||
domList=("${domList[@]}" ${validDomain})
|
||||
domList=("${domList[@]}" ${domain})
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue