Convert domain names to lower case before checking validity of the domain

This commit is contained in:
DL6ER 2016-11-21 15:49:11 +01:00
parent 3ba7d7640f
commit 4c10634d85
1 changed files with 5 additions and 2 deletions

7
advanced/Scripts/list.sh Normal file → Executable file
View File

@ -51,8 +51,11 @@ EOM
}
HandleOther(){
#check validity of domain
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
# First, convert everything to lowercase
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
#check validity of domain
validDomain=$(echo "$domain" | perl -ne'print if /\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