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
  • Gamma@programming.dev
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    3 months ago

    Select the color which matches the steps before filenames ((non-)login and (non-)interactive), then follow that arrow the rest of the way. There’s more colors in Bash because Bash makes a distinction between remote and local shells.

    Another way to look at the same data for Zsh (note: $ZDOTDIR will be used instead of $HOME if it’s defined at any step along the way):

    File neither interactive login both
    /etc/zshenv x x x x
    ${ZDOTDIR:-$HOME}/.zshenv x x x x
    ${ZDOTDIR:-$HOME}/.zprofile x x
    ${ZDOTDIR:-$HOME}/.zshrc x x
    ${ZDOTDIR:-$HOME}/.zlogin x x
    ${ZDOTDIR:-$HOME}/.zlogout x x

    One confusion on the Bash side of the diagram is that you see branching paths into ~/.profile, ~/.bash_profile and ~/.bash_login. Bash will use for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and execute only the first one that exists and is readable.

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

      And what’s confusing is that many times those files still manually call the others to make it more logical like zsh. That’s what I remember at least, it’s been quite a while since I used bash.

      • Gamma@programming.dev
        link
        fedilink
        English
        arrow-up
        4
        ·
        3 months ago

        manually call the others

        Yeah, most distros will set up source chains to make things nicer for users.