Why isn't this bash working to change IPv6?

I haven’t done this in awhile so I’m rusty, but I can’t see why this script isn’t working! I’m hoping another set of eyes can see the issue.

The goal is to turn off IPv6.

It prints “Get zone ID…”, and then it just doesn’t go any further until I Ctrl+C.

#!/bin/sh

domain=example.com

[email protected]
key=foo

printf "Get zone ID...\n"

zone_id=$(curl --request GET \
		--silent \
		--url https://api.cloudflare.com/client/v4/zones/?name=$domain \
		--header "X-Auth-Email: $email" \
		--header "X-Auth-Key: $key" \
		--header 'Content-Type: application/json' | jq -r '.result[] | .id')

if [[ -z $zone_id ]]
	then
		printf "Zone ID failed\n\n"
		continue
fi

printf "Zone ID: $zone_id...\n"
printf "Attempting IPv6 fix...\n"

ipv=$(curl --request PATCH \
	--silent \
	--url https://api.cloudflare.com/client/v4/zones/$zone_id/settings/ipv6 \
	--header "X-Auth-Email: $email" \
	--header "X-Auth-Key: $key" \
	--header 'Content-Type: application/json' \
	--data '{
		"value": "off"
	}' | jq '.success')

if [[ $ipv == true ]]
	then
		printf "IPv6 succeeded...\n"

	else
		printf "IPv6 failed...\n"
fi

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.