From 87f459d78e2eeb6b536ce4dc876f6bd5e5b07e89 Mon Sep 17 00:00:00 2001 From: hiska Date: Mon, 12 Feb 2018 18:04:03 +0900 Subject: [PATCH] changed sed -n to _egrep_o()|sed|tr -d combination --- dnsapi/dns_dnsever.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dnsapi/dns_dnsever.sh b/dnsapi/dns_dnsever.sh index ba7034e..e0735e5 100644 --- a/dnsapi/dns_dnsever.sh +++ b/dnsapi/dns_dnsever.sh @@ -97,7 +97,9 @@ dnsever_txt() { fi fi - skey=$(printf "%s\n" "$response" | grep skey | sed -n "s/^.*value=['\"]\(.*\)['\"].*/\1/p") + skey=$(printf "%s\n" "$response" | _egrep_o "name=\"skey\" value=\".+\"" | cut -f3 -d= | tr -d \") + _debug skey "$skey" + if [ -z "$skey" ]; then _err "dnsever_txt:$action ERROR login failed with login_id=$login_id login_password=$login_password" response=$(_post "skey=$skey" "https://kr.dnsever.com/logout.php") @@ -105,6 +107,7 @@ dnsever_txt() { fi user_domain=$(dnsever_select_user_domain "$fulldomain" "$response") + _debug user_domain "$user_domain" if [ -z "$user_domain" ]; then _err "dnsever_txt:$action ERROR no matching domain in DNSEver" @@ -115,6 +118,7 @@ dnsever_txt() { if [ "$action" = "add" ]; then subname=$(echo "$fulldomain" | sed "s/\.$user_domain\$//") + _debug subname "$subname" if [ -z "$subname" ] || [ -z "$txt" ]; then _err "dnsever_txt ERROR subname=$subname or txt=$txt is empty" @@ -203,7 +207,9 @@ dnsever_select_user_domain() { fulldomain="$1" response="$2" - domains=$(printf "%s\n" "$response" | grep OPTION | sed -n "s/^.*value=['\"]\(.*\)['\"].*/\1/p" | grep -v "^$") + domains=$(printf "%s\n" "$response" | awk '/