• Mwa@thelemmy.club
    link
    fedilink
    English
    arrow-up
    23
    arrow-down
    2
    ·
    7 days ago

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

      • Mwa@thelemmy.club
        link
        fedilink
        English
        arrow-up
        6
        arrow-down
        2
        ·
        7 days 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

        • Hawke@lemmy.world
          link
          fedilink
          arrow-up
          21
          ·
          7 days 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.

        • trevor (any/all) @lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          12
          ·
          7 days 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.

    • JackbyDev@programming.dev
      link
      fedilink
      English
      arrow-up
      3
      ·
      5 days 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
          2
          ·
          5 days 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
            1
            ·
            5 days ago

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

            • JackbyDev@programming.dev
              link
              fedilink
              English
              arrow-up
              1
              ·
              5 days ago

              Ah, I see. If you don’t remember, don’t sweat. I’m mostly curious just because posix issues is one of the few complaints I hear but I never see anything specific so I’m extremely curious lol. Please don’t mistake this as one of those fanboyism moments where people try to say something they like is actually perfect and doesn’t have flaws.

              My understanding of shebangs is that it isn’t your shell doing anything fancy with it, it’s your OS (or something, I don’t remember exactly, but it’s lower level than the shell). So maybe something else borked. But I’m no fish expert, I have some error in some fish thing that prints an error every time I open a new shell that I’m too lazy to troubleshoot lol.

  • inzen@lemmy.world
    link
    fedilink
    arrow-up
    20
    ·
    7 days ago

    I use fish because it was the default in cachyos and decided to give it a fair shake. I like the built in syntax highlighting and fancy autocomplete but I miss bash scripting and built in commands that replace standard commands can be weird sometimes. I have not tried scripting fish, to lazy to learn yet another scripting language, especially if bash is the (almost) de-facto standard.

    • ferret@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      17
      ·
      7 days ago

      You can always just continue using bash scripting, with a bash shebang in your scripts, if you miss it

      • Gumus@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        6
        ·
        7 days ago

        That’s what I do. Fish is great as interactive shell, scripts don’t benefit that much from it and I can use what’s familiar.

    • lapping6596@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      5 days ago

      I’ve been using it for awhile now for the same reason, and think I’m going to switch back to sh as it has too many suggestions which I read and it interrupts my thoughts and slows me down.

    • prole@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      2
      ·
      5 days ago

      I like having fish as an option, but don’t think I’d ever use it as my default.

      If I have a long command that uses long filenames, or I don’t remember the syntax of something, I can just type “fish” and it’ll open up a fish shell.

  • YTG123@sopuli.xyz
    link
    fedilink
    arrow-up
    6
    ·
    5 days 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).

  • mystic-macaroni@lemmy.ml
    link
    fedilink
    arrow-up
    17
    ·
    7 days ago

    I can’t begin to say how superior my fish rice is to any alternative. So I won’t. And I’ll leave yall to flame me for implying it.

  • obnomus@lemmy.ml
    link
    fedilink
    English
    arrow-up
    14
    ·
    7 days ago

    I think I’m using fish and it works great, I love alt+s thing and auto complete thingy.

    • flying_sheep@lemmy.ml
      link
      fedilink
      arrow-up
      13
      ·
      7 days 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
        2
        ·
        7 days 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
          2
          ·
          6 days 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
    5
    ·
    7 days 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.]

  • xxxb@feddit.org
    link
    fedilink
    arrow-up
    3
    ·
    6 days ago

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