[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: User's bin path not recognised in login script



On 22/03/16 19:00, The Wanderer wrote:
... <see above>

How did you test? By launching a new terminal (with bash set as your
default shell), by running the command 'bash' in an existing terminal,
by logging all of the way out (to the main login prompt, if not to a
full reboot) and then logging back in, or by running the command 'bash
--login' in an existing terminal?

In my testing just now, only the latter two of these four will pick up
the new ~/.profile file; the other two seem to run the commands which
were present in the file which their parent bash session used. (Strictly
speaking I didn't test the full logout or reboot, but I fully expect
that that would pick up the changes.)


Also, at least on my system, ~/.bashrc is invoked only by being sourced
from ~/.profile or ~/.bash_profile. Unless your system is configured
fairly differently, if ~/.bashrc is getting run, that means that - per
bash(1) - one of ~/.bash_profile, ~/.bash_login, or ~/.profile must be
invoking it.

I tested by rebooting each time. My ~/.bashrc is sourced from ~/.profile which itself is sourced from .bash_profile, but neither of them run the echo command I've added so I would assume the ~/.bashrc which runs when I open a Mate terminal is started some other way.

bash --login does invoke ~./bash_profile and hence ~./profile as the echos are seen in the output file (in the expected order), but I must admit the nature of login shells / non-login / interactive shells, etc is a bit beyond my experience. I've never tried bash --login before as I haven't previously come across it.

Maybe what this is telling me is that I should run another script from my "login" script by 'bash --login real_login_scriptfile' in order to get these profiles to run first?


Reply to: