[CentOS] root .bash_profile?

Bee.Lists bee.lists at gmail.com
Mon May 13 17:39:27 UTC 2019


$ man bash (INVOCATION)

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file
       exists.  After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first  one  that  exists  and  is
       readable.  The --noprofile option may be used when the shell is started to inhibit this behavior.

But the reference to .bash_profile has some unclear restrictions or boundaries:

~/.bash_profile
              The personal initialization file, executed for login shells

First, the ~ which might not apply to root.  Second, it’s a “personal” init file, which also might not pertain to root.  Going from user to root (su) might not initiate a login shell.  I’m not clear on this. 

But, .bash_profile is not loading.

I have my aliases in another file called /root/.bash_aliases, which is a duplicate of my /home/myuser/.bash_aliases which is NOW sourced in my /root/.bashrc so it now works.

So ya, got it to work, but knowing the cascade of inclusions is important.  root is as important to me as my normal user.  



> On May 13, 2019, at 1:17 PM, Christian, Mark <mark.christian at intel.com> wrote:
> 
> $ man bash, search on INVOCATION



Cheers, Bee






More information about the CentOS mailing list