Sample Header Ad - 728x90

Where should I source /usr/local/etc/profile from? .bash_profile or /etc/profile?

1 vote
2 answers
1729 views
I know that, by default, bash will source /etc/profile and ~/.bash_profile. Now, suppose I also have machine-specific profile commands in /usr/local/etc/profile (involving stuff that's in /usr/local, hence I don't want to sully /etc with it). My question: Whose responsibility is it to source /usr/local/etc/profile ? Should it be sourced within ~/.bash_profile, or perhaps the lines:
if [ -f /usr/local/etc/profile ]; then
    . /usr/local/etc/profile
fi
_should_ actually be within /etc/profile, since they're valid for any installation of the distribution regardless of what's on the actual machine?
Asked by einpoklum (10753 rep)
Dec 9, 2021, 09:50 AM
Last activity: Dec 9, 2021, 02:15 PM