Skip to content

Commit

Permalink
shfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
alviy authored Apr 27, 2024
1 parent dbe7cb8 commit dab244a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions dnsapi/dns_alviy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@ _get_root() {
domain=$1
i=3
a="init"
while [ ! -z $a ]
do
while [ ! -z $a ]; do
a=$(printf "%s" "$domain" | cut -d . -f $i-)
i=`expr $i + 1`
i=$(($i + 1))
done
num=`expr $i - 3`
h=$(printf "%s" "$domain" | cut -d . -f $num-)
n=$(($i - 3))
h=$(printf "%s" "$domain" | cut -d . -f $n-)
if [ -z "$h" ]; then
#not valid
_alviy_rest GET "zone/$domain/"
Expand All @@ -125,8 +124,8 @@ _get_root() {
if _contains "$response" '"code":"NOT_FOUND"'; then
_debug "$h not found"
else
s_n=`expr $num - 1`
_sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s_n)
s=$(($n - 1))
_sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s)
_domain="$h"
return 0
fi
Expand Down

0 comments on commit dab244a

Please sign in to comment.