• Victor@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    3 hours 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! 🙏