• alias_qr_rainmaker@lemmy.worldOP
    link
    fedilink
    arrow-up
    3
    ·
    1 day ago

    i need to get familiar with fish. i’ve studied the syntax but i still have hardly used it, and if you really want to learn how to code something, you gotta keep typing it until it’s in your muscle memory.

    • Herzenschein@pawb.social
      link
      fedilink
      arrow-up
      13
      ·
      1 day ago

      While I do like fish syntax, you don’t really need to learn it. You can just use it for your interactive use in the terminal while writing your scripts in bash.

      • Pika@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        this is basically what I did until I dropped fish for zsh because of annoyances with how it functioned.

        Scripting in fish is obnoxious though if you learned bash first, heavily recommend staying far away 😂

        Hard recommend staying in bash or at least zsh, at least you maintain compatibility with others if you ever decided to share your scripts.

        • BlueBockser@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          23 hours ago

          I tried using zsh again after having used fish for a while, but I just couldn’t do it. Trying to configure the ergonomics that fish ships OOTB into zsh was a pain, and I couldn’t get it to a satisfactory level.

          Regarding scripts, you don’t have to use the fish scripting language. Just keep writing your scripts in Bash, and as long as you use a shebang, it’ll work fine in fish.

          • Pika@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            2
            ·
            16 hours ago

            Yeah, that was what I was saying it wasn’t super clear. I was saying, just keep your scripts in Bash because it has better compatibility 👀

        • Victor@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          11 hours ago

          Scripting in fish is so much better than bash, holy. Reduced my scripts’ LOC by probably 50% and made them actually legible when coming back to them 6 months later. I converted all my personal scripts from bash to fish.

          What makes it “obnoxious”??

          • Pika@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            1
            ·
            4 hours ago

            I dislike heavily how flow control works on it, and the lack of indication where it starts to where it ends, the function layout, not to mention attempting to pipe anything via it. This combined with the fact that it’s a lesser used shell and as such has less of a presence online to research made it not worth the time and effort to actually use it. I swapped to ZSH which at least maintains a large POSIX compliance which makes it easier to share the scripts as well and also supports adding many of fish’s features.

            It may be nicer to read but, actually getting established, learning it, using it and then maintaining compatibility with other programs and scripts when using it, just made it not worth it. I have better things to do with my free time then to try and fight a shell every step of the way to make it look cleaner.

            • Victor@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              3 hours ago

              I dislike heavily how flow control works on it

              You mean its if and switch statements? For and while loops? Just like bash and zsh has?

              the lack of indication where it starts to where it ends

              You mean the end keyword? The start of things should be clear enough. Keywords are used for them depending on what you’re starting. I like the fact that everything ends with the same keyword. Much simpler.

              the function layout, not to mention attempting to pipe anything via it

              Piping something “via the function layout”? I’m not even sure what that means. I’d love to know more if you would.

              maintaining compatibility with other programs and scripts when using it, just made it not worth it

              This should be fully transparent. It’s a shell. I switched all my scripts to fish, and my integration with my desktop environment was completely unchanged. It’s just text in and text out.

              I have better things to do with my free time th[a]n to try and fight a shell every step of the way to make it look cleaner.

              I mean… It took me like an hour to read through the documentation, and all the syntax is so small you can memorize the entire language.

              It comes with a nice web based documentation built in. And all the built-in commands have their own man page for easy reading, compared to the jumbled mess of zsh’s docs. I could never find a goddamn thing in zsh’s two handfuls of different man pages. Nothing was where I thought it would be.

              It kind of sounds like you were fighting fish rather than it fighting you, every step of the way. That sounds absolutely crazy compared to my experience.


              My experience with fish is that I finally understood what my shell was doing and how it works, compared to zsh. I even understood what bash was doing. zsh, no. And all these files it was leaving around my home directory.

              What I will concede is that you should not convert your shell scripts if you need portability. If your scripts will be on multiple computers, fish is a bad idea if you don’t control them all.

              Otherwise it feels like some other issue is bigger here, because fish is so much simpler. Coming from me who’s been scripting in bash and zsh for about 20 years, and zsh is the only one that has stumped me, and whose documentation I’ve been struggling with. Even bash’s is better. 💀

              • Pika@sh.itjust.works
                link
                fedilink
                English
                arrow-up
                1
                ·
                3 hours ago

                You mean its if and switch statements? For and while loops? Just like bash and zsh has?

                No i mean the flow in general. It’s ugly and not transparent when compared to bash or any other language

                the lack of indication where it starts to where it ends

                Yes and no, I mean how it chooses to start and end, there is no punctuation, it seems to emulate a tab oriented language without being a tab oriented language.

                Piping something “via the function layout”? I’m not even sure what that means. I’d love to know more if you would.

                Two separate complaints, I dislike how they manage functions (but yes bash does similar on this case). Piping and redirecting are badly implemented and what would be an accepted pipe in ZSH or Bash will fail in fish. I made a script that had to pipe a file via wget and it wouldn’t function unless I used a pager which wasn’t needed in Bash or Zsh and wasn’t documented as a requirement anywhere on their piping or redirection documentation. Took me almost an hour of troubleshooting why the command was failing and how to fix it due to it.

                I mean… It took me like an hour to read through the documentation, and all the syntax is so small you can memorize the entire language.

                Maybe this has changed since I last tried about a year or two ago, but last time I tried to read the documentation it sucked hardcore and lacked examples of more advanced parts of the shell.

                It kind of sounds like you were fighting fish rather than it fighting you, every step of the way. That sounds absolutely crazy compared to my experience.

                I would rather take the path of least resistance for a program, with fish it had way too much resistance trying to use it, so I went to the path that had a lesser resistance, which was ZSH, and then just proceeded to add fish’s core capabilities to zsh. This let me use a scripting language that has a lot of documentation and examples to assist in learning, while having the benefits of the shell. Plus it lets me actually share the scripts with friends because it’s already hard to find someone on linux, and its even moreso difficult to find someone who uses fish shell.

      • null@piefed.nullspace.lol
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 day ago

        This is the way. I’ve never even attempted to script anything in fish, but it’s just a great interactive shell OOTB. I think at most I have a colorscheme and an alias or 2.

        • Victor@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          11 hours ago

          Scripting I’m fish is so much better than bash, holy. Reduced my scripts’ LOC by probably 50% and made them actually legible when coming back to them 6 months later. I converted all my personal scripts from bash to fish.

      • Lena@gregtech.eu
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        Yeah that’s what I do to, I don’t need to write complex scripts anyway. Fish’s syntax seems interesting though.

      • alias_qr_rainmaker@lemmy.worldOP
        link
        fedilink
        arrow-up
        1
        ·
        17 hours ago

        Python is my #1 language. It’s the one I always code in. But I also know javascript and bash/zsh (also Ruby but I haven’t written any ruby for years, so I’d need a refresher)

        • luciferofastora@feddit.org
          link
          fedilink
          arrow-up
          1
          ·
          14 hours ago

          At my previous job, I had only barebones beginner skills in Java and absolutely no idea of Java EE when I started. I reckon you’d get back in the flow with Ruby quickly enough.

          But also, python is nice.