• Victor@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    21 hours ago

    Ever since I switched to Fish Shell, I’ve had no issues remembering anything. Ported my entire catalogue of custom scripts over to fish and everything became much cleaner. More legible, and less code to accomplish the same things. Easier argument parsing, control structures, everything. Much less error prone IMO.

    Highly recommend it. It’s obviously not POSIX or anything, but I find that the cost of installing fish on every machine I own is lower than maintaining POSIX-compliant scripts.

    Enjoy your scripting!

    • LeninOnAPrayer@lemm.ee
      link
      fedilink
      English
      arrow-up
      0
      ·
      9 hours ago

      I wish I could but since I use bash at work (often on embedded systems so no custom scripts or anything that isn’t source code) I just don’t want to go back and forth between the two.

    • alt_xa_23@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      14 hours ago

      I switched to fish a while back, but haven’t learned how to script in it yet. Sounds like I should learn

    • raldone01@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      15 hours ago

      I love fish but sadly it has no proper equivalent of set -e as far as I know.

      || return; in every line is not a solution.

    • UndercoverUlrikHD@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      15 hours ago

      If you’re going to write scripts that requires installing software, might as well use something like python though? Most Linux distros ship also ship with python installed

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        8 hours ago

        A shell script can be much more agile, potent, and concise, depending on the use case.

        E.g. if you want to make a facade (wrapper) around a program, that’s much cleaner in $SHELL. All you’re doing is checking which keyword/command the user wanted, and then executing the commands associated with what you want to achieve, like maybe displaying a notification and updating a global environment variable or something.

        Executing a bunch of commands and chaining their output together in python is surely much more cumbersome than just typing them out next to each other separated by a pipe character. It’s higher-level. 👍

        If it’s just text in text out though, sure, mostly equivalent, but for me this is rarely the use case for a script.

        • UndercoverUlrikHD@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          7 hours ago

          I’m not anti bash or fish, I’ve written in both just this week, but if we’re talking about readability/syntax as this post is about, and you want an alternative to bash, I’d say python is a more natural alternative. Fish syntax is still fairly ugly compared to most programming languages in my opinion.

          Different strokes for different folks I suppose.