There are some observations I have made / struggled with on Leap 42.3 login.
- LESS variable is set.
While on the surface this seams harmless, it interferes with other applications. In my case, I am working on a software project. I use Mercurial for my Version control system.
Mercurial uses LESS to set appropriate defaults if it is not already set. Unfortunately this is being set by /etc/profile.
Example: in a new mercurial repository with no changes, I type hg status. Normally, this would simply return. However with the LESS setting, it always pops into a blank less screen that
I have to quite from. This is very annoying and contrary to expected behavior.
The obvious solution is to unset LESS less. This is indeed what I do. I do find it unfortunate that I have had to do this.
- When you login to a bash session, the following scripts are sourced in order:
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
In addition, when an interactive bash shell is started that is not a loign shell, the following scripts are sourced:
/etc/bash.bashrc
~/.bashrc
The order here is very important. For a user login, .bash_profile, .bash_login, .profile and .bashrc are available for setting their environment.
.bash_profile, .bash_login and .profile are used to setup static setting that need to be set only once. For example the PATH variable is set here.
.bashrc is typically use for setting environment that may change or need to be reset between bash instances.
I typically use .bash_profile and .bashrc for my uses (I do source .alias if it exists from .bashrc). It is important that .bash_profile is run first, as it set static setting
that may be used by .bashrc.
Unfortunately, /etc/profile source the following:
.alias
.bashrc
.bash_profile
In that order. This is completely backwards and breaks expected behavior. I have aliases and other setting that fail in .alias and .bashrc because .bash_profile has not been sourced
as expected.
Most trubling is that .alias is being source first. Typically sourcing .alias is a user discretion from .bashrc. Indeed the default out of the box .bashrc script for Leap 42.3 does just this.
This means that .alias is being sourced from /etc/profile and .bashrc (twice) before .bash_profile.
I am wondering why this is being done. My environment relies on expected order of scripts being sourced. I have had to do a good amount of coding to ensure that the proper order
is followed. I have hacked .alias to insure that it is only run once.