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:

ipadr=ip -4 addr show eth0 | grep inet | awk '{print $2}' | awk -F "/" '{print $1}'
curl -X PUT “
-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.

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.