In this post, I go into hopefully better output parsing.

  • dengtav@lemmy.ml
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    2 days ago

    Isn’t it incredible, that we have to read blogposts to learn how to extract an IP addr of a network interface in the shell … in json … in 2025 ??!

    Some problems will never really get solved.

    Thanks for the write up !

    • Laser@feddit.orgOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      2 days ago

      You’re welcome! And actually, even this approach can yield surprising results… As in have you heard of deprecated IPv6 addresses before? Well I hadn’t until I realized my interface now had one (it actually didn’t anymore when I wrote the post, I used the jq command on old output, not in a pipe). Which made my DynDNS script stop working because there was now a line break in the request URL that curl rightfully failed on.

      Edit: also despite what the title of the post says, in not an authoritative expert on the matter and you can use whatever works for you. I see these posts more as a basis for discussions like here than definitive guides to do something the correct way.

      • dengtav@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        2 days ago

        As in have you heard of deprecated IPv6 addresses before?

        Definetly not 0.o

        It’s really hard to actually believe that a problem like this hasn’t got a 1-word-command + flag solution yet. I mean you could ecxpect something like

        ip -6 -i eno0
        

        or so…

        And yes, totally agree on the edit part! It’s always nice to at least no about all the options that exist and smb found out hustling the same struggle like me :D