• Mwa@thelemmy.club
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 months ago

    i am using ZSH cause Fish is not POSIX compliant,which made it annoying to run scripts without rewriting them.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      4 months ago

      When is this a problem? What scripts don’t use a shebang and/or why does using sh call fish instead of bash or dash?

      I have a mild dislike of fish because a few substitutions are different enough that my muscle memory isn’t there. (But I also haven’t put in serious effort to learn them.)

        • JackbyDev@programming.dev
          link
          fedilink
          English
          arrow-up
          0
          ·
          4 months ago

          Have you run into a specific problem or is this just a hypothetical you’re worried about. I see this a lot but haven’t ever actually run into it being a concern. If you run a script with #!/bin/sh from a Fish shell, it won’t use Fish, it will use whatever you have sh pointing to. (Which shouldn’t be Fish, it’s usually bash or dash.)

          • Mwa@thelemmy.club
            link
            fedilink
            English
            arrow-up
            0
            ·
            4 months ago

            I ran into issues on fish,i don’t remember what they are but I think it’s no shebang

      • Mwa@thelemmy.club
        link
        fedilink
        English
        arrow-up
        0
        ·
        4 months ago

        how about if its not in a sh file,its common for scripts to use sh or bash instead. but am just gonna stick to ZSH anyways

        • trevor (any/all) @lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          0
          ·
          4 months ago

          The file extension doesn’t matter much on Linux. If you’ve got a shebang at the top, the shell you’re running from will invoke the correct shell according to the shebang.

          In some situations, you may want to use something like bash <your-script>, but that would only be when you’ve got a script that doesn’t have a shebang, but not having one is bad practice and you really should be using them. Fish isn’t the only non-POSIX shell you’re going to encounter on a Linux system. Python, Perl, and probably some others will be there, and using a shebang ensures no shenanigans. So whether or not you use Fish, you should always use shebangs.

        • Hawke@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          Linux doesn’t generally use extensions to decide what shell to use, so it doesn’t matter if it’s an sh file or not.

          If it uses bash of course you can substitute #!/bin/bash

          And of course you can use whatever shell you want, just saying that POSIX-compliance is not really relevant since the script can specify what shell it needs.

  • xxxb@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    When I installed freeBSD for the first time, I was so confused when !! didn’t work.

    • flying_sheep@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      That’s a paradox. POSIX shells are all bad because POSIX demands bad syntax.

      You can have pain word strings without also having weird “variables auto-explode into words” bullshit.

      That’s why I use nushell. It has lists. You do cmd ...$some_list to call a command on arguments from a list.

      • Sivecano@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        0
        ·
        4 months ago

        I’m ok with that part, I’m talking more performance and convenience. POSIX isn’t the most amazing but it’s ok. And whether I like it or not, I’ll have to use a posix-compatible shell if I want to run most scripts.

        • flying_sheep@lemmy.ml
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          I luckily don’t have to modify scripts these days so I’ll just use bash to run them if there’s no better alternative around. And usually it is, few things are only available as bespoke shell script

  • Digit@lemmy.wtf
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 months ago

    Heh. Good stuff.

    More! ;D I want to see all the shells, characterised so.

    … Fish [over[1]]user here. Ooh, good burn. LOL.

    [1: Not just user. Overuser. I do most of my scripting in fish. Think that’s not overuse yet? … I even wrote my own text editor in fish.]

  • YTG123@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    4 months ago

    I’ve never understood the need for fish. The shell experience is basically the same as zsh, and although it’s much more pleasant to script for, you miss out on compatibility with POSIX-compliant snippets, and besides, if you’re writing long and complicated scripts that need anything more than a handful of scalar variables you should probably be using Python (or Perl if you’re an old-school masochist).

  • Dagnet@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 months ago

    imo fish is the best out of the box for me, but I just use bash cause its everywhere

    • Skullgrid@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      I’m not learning shit that can’t run on everything.

      Source : I got a fistfull of salesforce certs in order to toe the line in my previous job, and I am currently looking for work.

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      Yeah, that’s where this meme fails. BASH is the default and has been for decades. Most people are not Gigachad.

      I’ll accept FISH as being for babies, Zsh as being for Emo types or extra nerdy people. SH being for white beards makes sense.

      BASH is:

      IT Guy

      • elephantium@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        4 months ago

        I used a macbook for work for a while with zsh in the terminal. IDK whether I qualify as emo, but I am nerdy. I only think of myself as regular nerdy, though, not extra nerdy.

        • merc@sh.itjust.works
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          Was zsh the default at the time? Or did you switch to zsh? AFAIK the new default is BASH, but it was zsh for a while.

          IMO, your level of nerdiness is much higher if you change the default shell.

          • elephantium@lemmy.world
            link
            fedilink
            English
            arrow-up
            0
            ·
            4 months ago

            I had to go back and check. Apple says that the default changed from bash to zsh in Catalina (10.15). I seem to recall a message coming up on the machine about zsh. I definitely remember poking around at config files and looking at iTerm2 vs. the default terminal app at the time.

            Does that make me extra nerdy? IDK. I can tell you that I was more focused on “What’s going to be comfortable to work with” vs. nerding out on shell differences.

            I do miss homebrew now that I’m working on a Windows laptop.

            • merc@sh.itjust.works
              link
              fedilink
              arrow-up
              0
              ·
              4 months ago

              Maybe I remember wrong, but my memory is that at one point MacOS had zsh as the default and then switched to BASH, and then maybe back to zsh again. But, since Internet search is broken these days, I can’t find anything about that.

              • elephantium@lemmy.world
                link
                fedilink
                English
                arrow-up
                0
                ·
                4 months ago

                All I can really tell you is that I remember seeing a message about the new default being zsh, and that was back in 2020 or maybe 2021. So it def switched from something else to zsh, but whether it was bash -> zsh or zsh -> bash -> zsh…shrug

    • mmmm@sopuli.xyz
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      I use bash because gentoo’s portage has a hard dependency on it so in my mind it doesn’t make much sense to install and keep yet another shell just because colors and autocompletion. If they ever get rid of the bashisms in portage I’d surely consider moving to fish, but getting rid of the bashisms in portage means that portage could be ported to the BSDs one more time and we could have Gentoo/BSD again

    • FedX@quokk.au
      link
      fedilink
      English
      arrow-up
      0
      ·
      4 months ago

      Yeah, I agree. It’s quirky, its syntax is annoying, and a good ZSH setup is probably better… but I don’t have the time to do an actual ZSH setup.

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        4 months ago

        A good zsh setup is not better. That’s why I switched off of zsh after years, because it was slower, more bloated, and less intuitive than fish. And bash is ten times worse than zsh.

        • FedX@quokk.au
          link
          fedilink
          English
          arrow-up
          0
          ·
          4 months ago

          Huh, the more you know. My only experience with ZSH is when I briefly used Manjaro, and it seemed fine at the time… but now that I say that I think about it, “Manjaro defaulting to it,” might have been a bit of a red flag…

          • tyler@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            4 months ago

            Yeah to get the same setup in zsh you have to install a plugin manager and then quite a number of plugins. Most people default to omz (oh my zsh) but that’s the slowest way. If you pick through all the managers you can get a decent one, but even without a manager the overhead of loading plugins is just slower than building it in like fish does. Fish just is better. And I don’t think I’ve ever once needed posix syntax. If I need to run a script and it doesn’t have a shebang at the start then I just run > bash and start the script there.

              • tyler@programming.dev
                link
                fedilink
                arrow-up
                0
                ·
                4 months ago

                lol yeah. Like I thought I needed all this crazy stuff tacked on when in reality I just wanted sane defaults. The only thing I add to fish now is the spaceship prompt.

    • smiletolerantly@awful.systems
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      I just wish fish would accept standard bash syntax in addition.

      Like, if you can warn me that “this is not how we set vars in fish, do this instead!” then you could also just, you know, do it.

      • nialv7@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        4 months ago

        I just wish my local restaurant would accept burger orders in addition.

        Like, if you can warn me that “this is a Chinese noodle restaurant, we don’t do burger here. Order one of these instead!” then you could also just, you know, make me a burger!

        • smiletolerantly@awful.systems
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          That analogy only holds if they cook the burger for you, hold it in front of you, and go “we don’t make this”, then throwing it out

          • nialv7@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            4 months ago

            No, it’d be like, when you asked them do you know what a burger is? They pointed at a picture of a burger on the wall (they put this picture on the wall because for whatever reason people kept asking them to make burgers), and told you, of course we know what a burger is, we don’t make them, now order noodles or get out!

            • smiletolerantly@awful.systems
              link
              fedilink
              arrow-up
              0
              ·
              4 months ago

              Okay, you know what… That’s actually better than what I said. Defeat acknowledged.

              (However, it still seems a bit silly to me. name="value" will prompt you to enter set name "value", with your exact name/value prefilled. As far as I know, it really is just syntax substitution; or am I wrong here? Are there semantic differences that can’t be translated?)

              • nialv7@lemmy.world
                link
                fedilink
                arrow-up
                0
                ·
                4 months ago

                i think it could be a slippery slope thing. things like name="value" are easy to parse and implement, but then what if people keep asking for a little bit more, and a little bit more again? bash’s syntax is very very complex, there will be no winners if fish has a half-assed implementation of what bash does, it’s better to not even start.

        • smiletolerantly@awful.systems
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          No, I’m really happy with fish in general and use its syntax. The only times are things like e.g. a coworker sending me a 3-line script and then not being able to just copy, paste, enter.

      • lime!@feddit.nu
        link
        fedilink
        arrow-up
        0
        ·
        4 months ago

        yea but the posix sh set syntax is atrocious so not supporting it is doing you a favor

        • Laser@feddit.org
          link
          fedilink
          arrow-up
          0
          ·
          4 months ago

          It’s Stockholm syndrome

          I mean who doesn’t like putting mandatory quotes around all variables (though exceptions, like in [[ ... ]] apply)?

          Or keywords like fi and esac or worrying about $IFS

      • EponymousBosh@feddit.online
        link
        fedilink
        English
        arrow-up
        0
        ·
        4 months ago

        Our last apartment had a microwave that insisted that the off/cancel button was ONLY for the microwave part and NOT the timer part, and if you tried to use it to turn off the timer, would display a message saying “push timer button to turn timer off” (or smth to that effect). I found it infuriating. I told my wife, “if they can program it to sass me, they can program it to turn the damn timer off.”

        Anyway. I get it.