Skip to content

Comment on Show HN: A fix for the .bash_profile .bashrc .profile madness

Comments

bash is the problem, the solution to this madness is to not use bash.

Don't other shells have similar issues? ZSH sources .zshenv, .zprofile, .zshrc and .zlogin (and corresponding /etc files) depending on the exact situation.

Only difference is that it does not source .profile unless it's in compatibility mode (invoked as `sh`)

The other difference is that zsh has a .zshenv (and /etc/zshenv), while bash only has $BASH_ENV, which only happen if it's set.

/etc/zshenv is always sourced, and there's no way to stop that. On the other hand, you can control if /etc/zshrc (etc) are sourced with:

  unsetopt GLOBAL_RCS
  IGNORE_SYSTEM_ZSH=1
But you would have to put it in .zshenv for it to get sourced at the right time.

Yeah, my point was simply that other advanced shells have as many files they may source as bash (if not more), with similar naming conventions. So holding that against bash and bash alone didn't make much sense.

The details and decision tree of zsh's initialization are rather well documented already (if complex) and beyond the scope of making that point.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.