2 ms·
> Quick, which of .bashrc, .bash_profile, .profile et al get run for any given type of login you do to a box? I appear to have just given up and symlinked them
by yjftsjthsd-h 4y ago
> Quick, which of .bashrc, .bash_profile, .profile et al get run for any given type of login you do to a box?
I appear to have just given up and symlinked them together. Anyone have a better idea?
Edit: Actually, my profile apparently has a conditional to detect what shell it's loaded by (which I did remember), and for at least bash a conditional to detect interactive mode (which I did not). So I'm still dealing with this, just not at the file level.
- Flimm 4y agoI found this blog post really helpful in explaining the difference: https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/ https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-... It references this blog post: https://meta.ath0.com/2007/10/23/cleaning-up-bash-customizations/ https://meta.ath0.com/2007/10/23/cleaning-up-bash-customizat...
- axelf4 4y agoI have written a small reference for this that has served me well: [1]. [1]: https://github.com/axelf4/dotfiles#bash-startup-files https://github.com/axelf4/dotfiles#bash-startup-files
- blueflow 4y ago$ENV is for interactive shells, .profile is for login shells. Normal shells source these files according to to which of the two flags are set or not. To make make bash behave in a compatible manner, you need to: - Delete .bash_profile, so .profile gets sourced instead (works around bash ignoring .profile when .bash_profile exists) - At the bottom of .profile, call $ENV (works around login bash ignoring bashrc) - Make .bashrc call or be equal to $ENV - At the head of $ENV, do an early exit for non-interactive shells (works around bash sourcing the bashrc when invoked non-interactively via SSH or socket, also works around the previous workaround) In terms of startup logic, bash is the worst shell i've seen so far.
- mr_mitm 4y agoI still haven't figured out where the canonical place is to put modifications to $PATH. Now I just source ~/.profile from .zshrc and .xsessionrc and ignore that some directories sometimes appear multiple times in $PATH.