#!/bin/bash PATH="/usr/local/bin:${PATH}" SUB_DOMAIN="${1:?Need customer subdomain code}" ZONE="linuxforward.com" # get subdomain record id record_id=$( ovhcli get "domain/zone/${ZONE}/record?fieldType=A&subDomain=${SUB_DOMAIN}" | jq -r '.[]' ) if [ -n "${record_id}" ]; then ovhcli delete "domain/zone/${ZONE}/record/${record_id}" | jq -r 'select(. != null)' sleep 2 ovhcli post "domain/zone/${ZONE}/refresh" | jq -r 'select(. != null)' else echo "Could not find any RecordID for ${SUB_DOMAIN}" fi exit $?