_err "No TXT records found for root domain ${root_domain_name} (Plesk domain ID ${root_domain_id}). Exiting."
return 1
fi
_debug "Got list of DNS TXT records for root domain '$root_domain_name'"':\n'"$reclist"
recid="$(_value "$reclist"\
| grep"<host>$1.</host>"\
| grep"<value>$txtvalue</value>"\
| sed-E's/(^.*<id>|<\/id>.*$)//g'
)"
_debug "List of DNS TXT records for host:"'\n'"$(_value "$reclist" | grep"<host>$1.</host>")"
if! _value "$recid" | grep-Eq'^[0-9]+$';then
_err "DNS records for root domain '${root_domain_name}' (Plesk ID ${root_domain_id}) + host '${sub_domain_name}' do not contain the TXT record '${txtvalue}'"
_err "Cannot delete TXT record. Exiting."
return 1
fi
_debug "Found Plesk record ID for target text string '${txtvalue}': ID=${recid}"
_debug 'Calling Plesk XML API to remove TXT record'
# printf using template in a variable - not a style issue