Does anybody know how to get my external ip in a shell script so i can use it as a DDNS?

Currently, I am using sdayman’s script, it works, but it sets the DNS to my local address:

#!/bin/bash
ipadr=ip -4 addr show eth0 | grep inet | awk '{print $2}' | awk -F "/" '{print $1}'
curl -X PUT “https://api.cloudflare.com/client/v4/zones/91834b073e2dd0e99847d7ba104db000/dns_records/aa636264d40be954453d8c3e31212272
-H “X-Auth-Email: myemail”
-H “Authorization: Bearer mykey”
-H “Content-Type: application/json”
–data ‘{“type”:“A”,“name”:“mydomain”,“content”:"’${ipadr}’",“ttl”:1,“proxied”:false}’
echo “”

You’ll need to use an external service. Easiest might be doing a web call, e.g. https://www.google.com/search?client=firefox-b-d&q=api+public+address

But, do you know how i could implement this into my code?

You will need to run a web call from your shell. cURL for example. For details please refer to StackExchange as shell scripting is beyond the scope of the forum.