From 85b3fef08d6b6dd145e66e9cc7e5db9db3c408e3 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 28 Jan 2017 00:39:10 +0100 Subject: [PATCH] Use perl instead of grep? --- advanced/Scripts/list.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index dce274c5..828bb2bc 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -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 }