Didn’t know about auto populating search queries, abbreviations, string scripting, and using private mode.

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

    I wish that string command and also their math command were just general-purpose utilities pre-installed on all systems.

    Tried to script something with sed the other day and was so confused why my regexes weren’t matching, until we realized you need to pass --regexp-extended to get modern-day regex.

    And then I later tried to calculate an average, which bc decided to round down, because it was presumably doing integer math. I actually ended up running python -c "print($total / $count)", because I could not be arsed to work out, if there was some flag to make bc work properly.

    I’m fine with these tools continuing to exist for legacy purposes, but I would like a modern replacement just about now.

    • Gamma@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 days ago

      string split/collect and similar can’t work unless its a builtin. The set foo ( ...... | string ... ) pattern couldn’t work if string was an external binary.

  • Gamma@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    10 days ago

    Scrubbing through the video, this hurts my soul

    echo $(echo $STRING | sed 's/World/Bash/')
    

    For variables bash has PE forms:

    echo ${STRING/World/Bash}
    

    I miss these too much when I try Fish.

      • Gamma@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        8 days ago

        Nothings bad about it. I don’t think it’s strictly better or worse. Just

        • I’m used to it
        • The comparison in the video was just disingenuous.
        • Laser@feddit.org
          link
          fedilink
          arrow-up
          1
          ·
          8 days ago

          I haven’t watched the video, but maybe it wasn’t in bad faith, but the author didn’t know better. bash can be arcane at times, like when I open my old scripts I often have no clue what exactly is going on without comments. Substring removal comes to mind.

  • SinTan1729@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 days ago

    It’s perfect for daily interactive use, but terrible for scripting. I write almost all my scripts in bash, the only exceptions being convenience scripts for fish itself.

    • Laser@feddit.org
      link
      fedilink
      arrow-up
      3
      ·
      9 days ago

      Same, but I don’t think it was ever intended differently; I mean the word interactive is literally in the name. If you want portable scripts, use bash. For simple helpers, quickly define a function. If you feel your script becomes too long, use Python.

      • SinTan1729@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 days ago

        Agree, although I’ve recently replaced the python usecase with Go. Almost as easy to write, but much faster and safer.

          • SinTan1729@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            3 days ago

            Well, it’s statically typed, and it’s memory safe. (There can be some race conditions during concurrent execution, but that’s not relevant for simple scripts.)

        • Laser@feddit.org
          link
          fedilink
          arrow-up
          1
          ·
          9 days ago

          Oh yeah, I never used Python myself and did some very simple (but IMHO too much hassle in bash) Go stuff some time ago. It’s a really good language for that, and if you can’t build on the target, the binary is statically linked anyways.

  • Sturgist@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    7 days ago

    I had to switch from fish to bash because one command to install S.T.A.L.K.E.R. - G.A.M.M.A only works in bash. I have no further details on why 🤷