How to get public IP of an Nvidia Shield Pro device via shell script?

Hi all,
I try to write a shell script on my Nvidia Shield TV Pro to find out the public IP assigned via my operator or the VPN. On a linux box it is very easy using commands like curl, wget or dig. However, on Nvidia’s restricted Android environment none of the exist. Any method to find out the public IP address of the device using linux shell scripting?
(Second question: I am testing the linux shell script on a ADB shell session. Is this the correct approach? I could only run my scripts by puttin a “sh” in front of them. Like “sh ./”. )

Thanks for helping out!