Browse Source

avoid temp file for domain list

Stefan Seidel 8 years ago
parent
commit
d1d2f6f451
1 changed files with 5 additions and 3 deletions
  1. 5 3
      dnsapi/dns_do.sh

+ 5 - 3
dnsapi/dns_do.sh

@@ -115,9 +115,11 @@ _get_root() {
   domain=$1
   domain=$1
   i=1
   i=1
 
 
-  _all_domains="$(_mktemp)"
   _dns_do_soap getDomainList
   _dns_do_soap getDomainList
-  echo "${response}" | tr -d "\n\r\t " | _egrep_o 'domain</key><value[^>]+>[^<]+' | sed -e 's/^domain<\/key><value[^>]+>//g' >"${_all_domains}"
+  _all_domains="/$(echo "${response}" \
+    | tr -d "\n\r\t " \
+    | _egrep_o 'domain</key><value[^>]+>[^<]+' \
+    | sed -e 's/^domain<\/key><value[^>]*>//g')"
 
 
   while true; do
   while true; do
     h=$(printf "%s" "$domain" | cut -d . -f $i-100)
     h=$(printf "%s" "$domain" | cut -d . -f $i-100)
@@ -125,7 +127,7 @@ _get_root() {
       return 1
       return 1
     fi
     fi
 
 
-    if grep -q "$(_regexcape "$h")" "${_all_domains}"; then
+    if _contains "${_all_domains}" "^$(_regexcape "$h")\$"; then
       _domain="$h"
       _domain="$h"
       return 0
       return 0
     fi
     fi