Created attachment 187128 [details]
Add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells
lately I was trying to find a clean way to implement global bashrc and what I've found in the web is partly working solutions and inefficient workarounds.
I also found, that bash itself has system-wide /etc/bash.bashrc in the source, but commented out. So I guess it's at least convenient have this option to be available and maybe this option should be default one.
Patch for Makefile attached.
Per tradition and according to hier(7) third party applications such as bash must not install config files under /etc but rather /usr/local/etc. I'd be ok with such a non-default option but it would would probably make sense to enable SYS_BASH_LOGOUT as well otherwise the next person is going to ask for such an option. The idea is that someone who's willing to have system wide login files would probably also like to have the benefit of a global logout file.
Would the proposed solution work for you?
Created attachment 187136 [details]
2nd version of add an option to enable system-wide /etc/bash.bashrc file for interactive bash shells
Proposal about SYS_BASH_LOGOUT seems fair.
Relocation to $PREFIX also looks fine.
Still if csh have global /etc/csh.cshrc I'd rather propose to make an option default, but since this option more like a deviation for bash itself I don't have strong opinion on this one.
Next version of patch attached above.
A commit references this bug:
Date: Sun Oct 29 11:37:07 UTC 2017
New revision: 453109
Provide an option to enable system-wide rc files.
- System-wide .bashrc file for interactive shells
- System-wide .bash_logout for login shells
Submitted by: firstname.lastname@example.org
Committed with minor modifications, thanks!
This patch works for interactive shells, but not for reading /usr/local/etc/bash.bash_login for a login shell. A user still needs ~/.bash_login, which can, of course, be symlinked to /usr/local/etc/bash.bashrc. Is this intentional?
MARKED AS SPAM