I've a few special aliases and such set up on a few servers (CentOS 7, bash shell).
Some of them are server specific (ex: what IP point to the internet, hostname of the server, etc), while others are relevant to all of them (command aliases and such).
I've set each server's unique aliases in the
~/.bash_profile file, which sources another file, spread via Git, with all the non-unique environment variables. That way, whenever I add an alias or variable I'd like all servers to add, I add it to the file and push it via Git.
However, I've come to understand that on some (seemingly rare) occasions, the non-unique aliases and variables are only available after sourcing
~/.bash_profile manually after logging in. Most of the time it works okay as is - I log in, and everything is set, while on other times another source is required.
I've tried sourcing the non-uniques file from different locations - using a script from
~/.bash_rc, which result in a loop which hangs login.
The bash_profile looks something like this:
# .bash_profile source "/etc/non_uniques_file" #Unique to this server alias servername=[name of server]...
And the non-uniques file looks something like this:
# Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH export HISTTIMEFORMAT="%d/%m/%y %T " export HISTSIZE=2000 export HISTFILESIZE=20000...
My question is - where would be the correct place to source the uniques file from, to have it set system-wide and under all circumstances?
What could be the reason these variables are set in some logins, but not on others, despite the same login method?