• Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        2
        ·
        19 hours ago

        I was waiting for someone to come along with this response lmao

        I’m terrible at remembering shell string operation syntax, but this is the ultimate answer.

        • sik0fewl@lemmy.ca
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          17 hours ago

          Definitely not the ultimate, since it’s not POSIX, but still a nice tidbit.

          • Badabinski@kbin.earth
            link
            fedilink
            arrow-up
            3
            ·
            17 hours ago

            Idk, writing POSIX-compliant shell is so miserable that I avoid doing it when I can. You can use Bash on BSD and all other unixes, so it’s still a relatively portable solution.

            • sik0fewl@lemmy.ca
              link
              fedilink
              arrow-up
              2
              arrow-down
              1
              ·
              17 hours ago

              True enough, but it’s pretty much the same to use sed, unless you need those milliseconds of performance boost.

      • Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        1
        ·
        6 hours ago

        idk who downvoted you, it’s a very common sentiment. I advocate for <<<, but a pipe is often fine when performance doesn’t matter.

        • a_non_monotonic_function@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 hours ago

          Performance doesn’t really matter with any of my scripts. They’re mostly for personal use.

          And the even funnier thing is getting downvoted for a style preference. XD