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

    Is the main issue that you are using test and extra indentation with fish? Like, does this help?

    yes that is better, I do like the clearer differentiation on what is a command vs part of the flow control. I do find that using [] or [[]] is cleaner looking than using the standard test command, but the main point of it was showing the flow; functions having a beginning { and an ending }, conditionals clearly using if to mark the beginning, ; then to mark when the conditional portion of the flow ends and the processing portion begins, and the fi to indicate when the processing portion ended. Flow control statements like that. Could I be able to decipher it manually like I have to with python? yes, but it’s just something that as a personal preference I would prefer not to do if avoidable.

    its easier to let me know that the previous line wasn’t done, and that I should be expecting the conditional to continue instead of start to work on the next line. The most noticeable would be with really long conditionals, I think its nice since bash and fish don’t use {} outside of functions to indicate open and close like other non-tab oriented languages. Moving longer lines to dedicated functions works well but doesn’t help when the entire conditional is related so it would just be in the main function block instead.

    It’s a very subjective thing, definitely more of a minor thing since I already have to deal with it with tab oriented languages on the rare occasion I deal with them. My main issues with it were definitely was the lack of usage leading to fewer examples and documentation on how it worked, and then the piping issue was just the final nail in the coffin that made me drop it.

    Maybe you are thinking about fish more as a programming language? Whereas I’m thinking about it more like a series of commands (I guess more like a “purer” scripting language of sorts)?

    Yes, that is likely the differentiation. I understand that bash is more command based but, I do a lot of stuff in java, node and Rust, and those all have clear differentiation of start and end (although rust’s can be a pain at times)

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

      Okay cool, I think I’m starting to understand a bit better now. 😄✨

      I do find that using [] or [[]] is cleaner looking than using the standard test command

      If I may blow your mind (really hoping you don’t already know this, otherwise it will be long, boring repetition, but here goes 😅):

      [ is actually just an alias for the test command, for which the closing ] is a required last argument (in fish it’s required; in bash it’s even optional!).

      In the documentation for both fish and bash, it really just starts with if list;, where list is a list of commands. This means we can do stuff like:

      if wget ...
      then
        # download successful
      fi
      

      And that’s why we can do this in bash too:

      if test ...
      then
        ...
      fi
      

      And even (in bash only; not fish):

      if [ $foo = 1 # no ending `]`
      then
        ...
      fi
      

      Further cementing that if can be seen as just a command that runs another command (its argument(s)), then controls the flow.

      I think this knowledge helps me feel more comfortable with the fish syntax, to have always in my mind that these can be considered “commands”, more than they are “syntax”. Sort of. Even if they are syntax to a certain degree of course.

      Does that all makes sense? 😅💫

      But anyway, I see and acknowledge all your points you’ve made throughout, even though I ignored them and focused only on those things I didn’t understand for the sake of profession. So I validate your feelings regarding those as well. Like, if you aren’t feeling comfortable with fish from the start, it won’t be easy since the community is smaller. For me, almost everything I needed was in the documentation, but sometimes people learn best by surfing around community information. Fish also isn’t exactly portable, indeed. Etc, etc. All these points you made, all good and valid. 👌

      You know what, I think fish is probably the kind of shell with which you sort of “fall in love”. It might not be a “try it for a month and see” thing, but more of a “hey I’m curious about this, let me check it out… Oh wow, I really like the opinionated design philosophy here, I will probably use this a long time, so let me install it” kind of deal. It’s for a specific kind of mindset I guess. Which I’m sure more people would realize that they actually have if they only knew about fish, but it’s still not for everyone, clearly. 🙂

      So while it does enable a more condensed scripting language, objectively, it might not be subjectively more legible if it’s hard to break free from the habit of bash and POSIX like syntax, which is very understandable.

      To wrap up, I thank you very much for going on this journey with me. I hope it was half as interesting for you as it was for me. I learned some things for sure. 😊 So thanks for your patience and replies! 🙏