Re:Fulfilling a reader's request for my “dot files”
by Flimm on Saturday May 06, 2023 @03:24AM
(#35839045)
I found this blog post really helpful in explaining the difference:
https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-...
It references this blog post:
https://meta.ath0.com/2007/10/23/cleaning-up-bash-customizat...
Re:Fulfilling a reader's request for my “dot files”
by axelf4 on Saturday May 06, 2023 @03:28AM
(#35839066)
I have written a small reference for this that has served me well: [1].
Re:Fulfilling a reader's request for my “dot files”
by blueflow on Saturday May 06, 2023 @04:45AM
(#35839441)
$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.
Re:Fulfilling a reader's request for my “dot files”
by mr_mitm on Saturday May 06, 2023 @08:35AM
(#35840754)
I 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.
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.