Fuck it, .zshrc it is.

Image transcription:

  • Top text: I STILL DON’T KNOW WHAT SHOULD GO IN .*RC VERSUS .*PROFILE
  • Bottom text: AND AT THIS POINT I’M AFRAID TO ASK
  • bigredgiraffe@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    I found this diagram on SO at one point but I can’t find the post and it is the best explanation I have found for how all of the files work for bash and zsh, each color is an individual path of execution (eg, follow the red line).

    Bottom line though, it only really matters if you are overriding something that is already defined, for example I tell my users to use zshrc and I provide defaults and common things in zprofile because zshrc is executed last when they login.

    • JackbyDev@programming.devOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 months ago

      I feel like I couldn’t make this more confusing if I tried. What is doing on with the golden arrows around /etc/profile??

  • Crow@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    Afaik the difference is whether a session is interactive or not, and non-interactive ones don’t source the rc

      • Crow@lemmy.blahaj.zone
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        Presumably just to get rid of unnecessary stuff that would slow down the start of all bash instances. Also aliases that could fuck with scripts

    • devfuuu@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      4 months ago

      Yeah. Fish just simplifies life everywhere. No longer do I need to care about those silly files or other configurations for basic stuff like search history.

      Best decision ever.

    • CodeBlooded@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      4 months ago

      Alright stranger, let’s hear it. What is it about Fish that you love so much?

      I’ve been generally happy with bash or zsh, pretty much whatever is installed by default (and I honestly don’t know the difference between the two I just mentioned 😬).

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        Once upon a time I was the person that was constantly messing with my shell. I would performance tune it, try out new plugins weekly, change my config often. It honestly became a huge waste of time. Since switching to fish I literally haven’t spent any time configuring it at all, besides adding in the fzf plugin and the fzf-marks plugin. It just works. And it has all of the same features that everyone adds to zsh with plugins straight out of the box.

        If you’re happy with the default in bash or zsh then you will be even more happy with the default in fish, as it’s just much much more user friendly (which is why so many people add so many plugins to bash and zsh: to make it more user friendly). You can even configure it (even the colors) with a web interface! No mucking about in text files if you don’t want to.

      • The Cuuuuube@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        Zsh has more features and customization options than bash. Fish has a ton of convenience features at the cost of POSIX compatibility (which many view as a good thing)

  • Korthrun@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    4 months ago

    It’s all about context. If you write a convenience function and put it in zshrc, scripts you run from the cli will not have access to the function as defined in zshrc. Same with aliases added by zsh plugins etc.

    If you need “the thing” on the command line, zshrc. If you also need it in scripts you run from the cli, toss it in the profile file.

    ETA: I personally keep the functions I want to access from scripts in .zshenv as I recall reading that this file is ALWAYS sourced.