Why is my ~/.profile being executed on opening a terminal?
Solution 1:
Although there are a number of possible reasons why this might happen (such as sourcing the .profile
from inside .bashrc
), it seems in this case the reason was that the Run command as login shell
box was checked under the terminal's Edit
--> Preferences...
General
tab.
The giveaway is that echo $0
shows -bash
(indicating a login shell) rather than plain bash
.
Note that gnome-terminal
has a similar setting, under Edit
-> Profile Preferences
--> Command
.