My bash init script (~/.profile) contains important initializations, but whenever I use shell-command or compile in emacs, that init file is not read, and without those initialization my bash commands in emacs will fail :( How do I force emacs to execute my init file for the shell that it's using for shell-command?
Clarification: I'm not talking about M-x shell, which reads my init file just fine when I symlinked .profile to .emacs_bash.
Move your initialization routines into your ~/.bashrc
file
Then add the line
source ~/.bashrc
into your ~/.bash_profile
file. See the bash man page for a detailed explanation of which startup files get loaded when. The key is the difference between an interactive and non-interactive shell, as well as the difference between a login and a non-login shell.
In general, .bash_profile
is run when logging into the system using a shell while .bashrc
is run when starting a new shell (The OS X Terminal application is an exception to this rule as it runs .bash_profile
for each new terminal instance). For more info in article form, look here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With