This site supports cURL to just respond with used IP Address to terminal.
To specify the IP version, just use the subdomains "ipv4" or "ipv6" respectively.
You can also do GET requests with "Accept: application/json" to get a JSON object with your current IP
Sample:
curl -H "Accept: application/json" https://ip-addr.info