ehartman |
05-31-2019 01:55 PM |
Quote:
Originally Posted by justasalad
(Post 6000799)
The problem is that it's not invoked after I put it in ~/.profile and log in. It does however work when I source ~/.profile. I've never really added anything to .profile before, and I have no idea if it's read at all.
|
The .profile script is only executed when the shell your window starts is a login shell. Other shells will invoke .bashrc
And of course for both a window with a command shell will have to be started, your window environment probably doesn't do it for you (mine does, but I've explicitly enabled it in the X session startup).
Code:
test -r /etc/profile && . /etc/profile
# test -r /opt/proto/profile && . /opt/proto/profile # now through /etc/profile.d
(there's a symbolic link in /etc/profile.d to /opt/proto/profile, and that one again will execute $HOME/.profile if found).
Note that the user dependant script can be called .profile, .bash_profile OR .bash_login, but only one of those is executed BY a login shell
Quote:
any of the personal initialization files ~/.bash_profile, ~/.bash_login, or ~/.profile.
By default, bash reads these files when it is invoked as a login shell (see INVOCATION below)
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.
|
(from the bash man page)
|