• Laser@feddit.org
    link
    fedilink
    arrow-up
    8
    arrow-down
    2
    ·
    9 hours ago

    Be aware that fish isn’t a POSIX-compatible shell enough, so you have to adjust syntax.

    • rtxn@lemmy.worldM
      link
      fedilink
      arrow-up
      14
      ·
      edit-2
      8 hours ago

      That isn’t incorrect, but it’s not as important as people make it out to be. Linux isn’t certified as POSIX-conformant either.

      People are way too stuck on POSIX regarding Fish specifically, but in shell scripting, POSIX compliance boils down to “can it run a pure sh script”. Bash is compliant. Zsh is partially compliant and needs to set an option to emulate sh. Fish uses a different syntax and is not compliant; if that is a problem, don’t execute sh scripts in Fish.

      POSIX compliance for shell scripts was important in the 80s and 90s when the #! directive wasn’t as commonly implemented and every script might be executed by the user’s $SHELL instead. That is no longer the case as virtually every Unix-like system’s program loader supports #!.

      • Black616Angel@discuss.tchncs.de
        link
        fedilink
        arrow-up
        2
        ·
        7 hours ago

        I use fish, but sometimes it acts weird. And lots of “just copy and past this command” kind of online solutions I have to put into bash.

        My main irk is when I want to forward a ‘*’ to a program but have to escape it.

      • Laser@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        6 hours ago

        It’s a cool shell, I use it as a daily driver (though I’m keeping a close eye on elvish which syntactically is even further away from classic shell), but the comments read like fish is basically zsh. And while zsh is pretty close to bash, fish isn’t.