Skip to content

Commit 71a7106

Browse files
committed
updates based on spellcheck
1 parent 9168809 commit 71a7106

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

dns_scripts/dns_godaddy

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (C) 2017,2018 Timothe Litt litt at acm _dot org
44

55
VERSION="2.0"
6-
PROG="`basename $0`"
6+
PROG="$(basename "$0")"
77

88
# This script is used to update TXT records in GoDaddy DNS server
99
# It depends on JSON.sh from https://github.com/dominictarr/JSON.sh
@@ -27,11 +27,10 @@ GETJSON='https://github.com/dominictarr/JSON.sh'
2727
VERB="y"
2828
DEBUG="$GODADDY_DEBUG"
2929
[ -z "$JSON" ] && JSON="$GODADDY_JSON"
30-
[ -z "$JSON" ] && JSON="`dirname $0`/JSON.sh"
30+
[ -z "$JSON" ] && JSON="$(dirname "$0")/JSON.sh"
3131

3232
while getopts 'dhj:k:s:t:qv' opt; do
3333
case $opt in
34-
b) GODADDY_BASE="$OPTARG" ;;
3534
d) DEBUG="Y" ;;
3635
j) JSON="$OPTARG" ;;
3736
k) GODADDY_KEY="$OPTARG" ;;
@@ -73,7 +72,7 @@ Arguments:
7372
Options
7473
-d Provide debugging output - all requests and responses
7574
-h This help.
76-
-j: Location of JSON.sh Default `dirname $0`/JSON.sh, or
75+
-j: Location of JSON.sh Default $(dirname "$0")/JSON.sh, or
7776
the GODADDY_JSON variable.
7877
-k: The GoDaddy API key Default from GODADDY_KEY
7978
-s: The GoDaddy API secret Default from GODADDY_SECRET
@@ -112,7 +111,7 @@ shift $((OPTIND-1))
112111
# we assume they'll be deleted later & don't want to strand them.
113112

114113
[[ "$JSON" =~ ^~ ]] && \
115-
eval 'JSON=`readlink -nf ' $JSON '`'
114+
eval 'JSON=`readlink -nf ' "$JSON" '`'
116115
if [ ! -x "$JSON" ]; then
117116
cat <<EOF >&2
118117
$0: requires JSON.sh as "$JSON"
@@ -148,7 +147,6 @@ if [ -z "$name" ]; then
148147
echo "'name' parameter is required, see -h" >&2
149148
exit 3
150149
fi
151-
! [[ "$name" =~ [.]$ ]] && name="${name}.${domain}."
152150
data="$3"
153151
if [ -z "$data" ]; then
154152
echo "'data' parameter is required, see -h" >&2
@@ -162,7 +160,7 @@ elif [ -z "$5" ]; then
162160
elif ! [[ "$5" =~ ^[0-9]+$ ]]; then
163161
echo "TTL $5 is not numeric" >&2
164162
exit 3
165-
elif [ $5 -lt 600 ]; then
163+
elif [ "$5" -lt 600 ]; then
166164
[ -n "$VERB" ] && \
167165
echo "$5 is less than GoDaddy minimum of 600; increased to 600" >&2
168166
ttl="600"
@@ -173,14 +171,14 @@ fi
173171
# --- Done with parameters
174172

175173
[ -n "$DEBUG" ] && \
176-
echo "$PROG: $op $domain $name \"$data\" $ttl" >&2
174+
echo "$PROG: $op $name \"$data\" $ttl" >&2
177175

178176
# Authorization header has secret and key
179177

180178
authhdr="Authorization: sso-key $GODADDY_KEY:$GODADDY_SECRET"
181179

182180
if [ -n "$TRACE" ]; then
183-
function timestamp { local tm="`LC_TIME=C date '+%T.%N'`"
181+
function timestamp { local tm="$(LC_TIME=C date '+%T.%N')"
184182
local class="$1"; shift
185183
echo "${tm:0:15} ** ${class}: $*" >>"$TRACE"
186184
}
@@ -264,7 +262,7 @@ EOF
264262
break
265263
fi
266264

267-
code="`echo "$response" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//'`"
265+
code="$(echo "$response" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//')"
268266
if [ "$code" = 'NOT_FOUND' ]; then
269267
continue
270268
fi
@@ -309,11 +307,11 @@ EOF
309307
exit $sts
310308
fi
311309
if ! echo "$result" | grep -q '^HTTP/.* 200 '; then
312-
code="`echo "$result" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//'`"
313-
msg="`echo "$result" | grep '"message":' | sed -e's/^.*"message":"//; s/\".*$//'`"
310+
code="$(echo "$result" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//')"
311+
msg="$(echo "$result" | grep '"message":' | sed -e's/^.*"message":"//; s/\".*$//')"
314312
if [ "$code" = "DUPLICATE_RECORD" ]; then
315313
if [ -n "$VERB" ]; then
316-
echo "$msg in $domain" >&2
314+
echo "$msg in $reqdomain" >&2
317315
fi
318316
exit 0 # Duplicate record is still success
319317
fi
@@ -350,8 +348,8 @@ $current
350348
EOF
351349

352350
if ! echo "$current" | grep -q '^HTTP/.* 204 '; then
353-
code="`echo "$current" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//'`"
354-
msg="`echo "$current" | grep '"message":' | sed -e's/^.*"message":"//; s/\".*$//'`"
351+
code="$(echo "$current" | grep '"code":' | sed -e's/^.*"code":"//; s/\".*$//')"
352+
msg="$(echo "$current" | grep '"message":' | sed -e's/^.*"message":"//; s/\".*$//')"
355353
echo "Request failed $msg" >&2
356354
exit 1
357355
fi

0 commit comments

Comments
 (0)