I’ve been struggling with a rather complex shell script, and it’s becoming apparent that Bash might not be the best choice for this particular task. While I usually gravitate towards statically typed languages like Go or Rust, I’ve noticed that many people recommend alternative languages such as Lua or Python for scripting tasks.

I’m curious to know your opinions and experiences with scripting languages for larger or more intricate shell scripts. Have you ever encountered a situation where Bash just didn’t cut it, and if so, which scripting languages did you turn to for a more effective solution? Are there any specific languages you found particularly suitable for debugging, testing, or handling complex logic in your shell scripts?

  • Ook the Librarian@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    11 months ago

    I do most of my scripting in perl too. Python has always irked me.

    Only semi-related: I recently switched from bash shell to fish. I should have don’t that years ago. Don’t know why I held on to bash so tight.

      • Ook the Librarian@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        I’m not the person to say anything about zsh vs. fish. I last tried zsh around 2008. Back then I decided to stick with bash over other shells. At the time (and for decades earlier) it was clear that sh was inadequate. So the Bourne Again Shell was (and still is) ubiquitous. Other shells fighting for user space seemed like the xkcd-927 problem.

        Now, I’m basically seeing that if I’m stuck without my .bashrc file, installing fish gives me most of the niceties I like. It also gives me niceties that I wouldn’t have been able to do, like nice multi-lining. And while I personally find fi and esac charming, they are pretty dumb. And I certainly don’t miss the for-do-done construction.

        I bet I would like zsh as much as fish, but I don’t have any motivation to try it.

        fish looks at my path to highlight mistyped commands. It autocompletes on the fly and autocompletes with attention paid to the usage in your history. The coolest thing is that it parses man pages. That allows autocomplete to know the options of a command as long as it has a proper man page (which it just should).