Browse Source

remove rev command

pull/5117/head
alviy 7 months ago
committed by GitHub
parent
commit
dbe7cb8dbb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      dnsapi/dns_alviy.sh

13
dnsapi/dns_alviy.sh

@ -102,7 +102,15 @@ dns_alviy_rm() {
# _domain=domain.com # _domain=domain.com
_get_root() { _get_root() {
domain=$1 domain=$1
h=$(printf "%s" "$domain" | rev | cut -d . -f 1-2 | rev)
i=3
a="init"
while [ ! -z $a ]
do
a=$(printf "%s" "$domain" | cut -d . -f $i-)
i=`expr $i + 1`
done
num=`expr $i - 3`
h=$(printf "%s" "$domain" | cut -d . -f $num-)
if [ -z "$h" ]; then if [ -z "$h" ]; then
#not valid #not valid
_alviy_rest GET "zone/$domain/" _alviy_rest GET "zone/$domain/"
@ -117,7 +125,8 @@ _get_root() {
if _contains "$response" '"code":"NOT_FOUND"'; then if _contains "$response" '"code":"NOT_FOUND"'; then
_debug "$h not found" _debug "$h not found"
else else
_sub_domain=$(printf "%s" "$domain" | rev | cut -d . -f 3- | rev)
s_n=`expr $num - 1`
_sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s_n)
_domain="$h" _domain="$h"
return 0 return 0
fi fi

Loading…
Cancel
Save