Why do (shell-command-to-string "echo $PATH")
and echo $PATH
in eshell
differ from echo $PATH
from ansi-term
and gnome terminal
in Ubuntu?
Some paths are missing from (shell-command-to-string "echo $PATH")
and echo $PATH
in eshell
.
Emacs apparently does not read .bashrc
nor .bash_profile
nor .profile
. Thus, paths added to $PATH
using export PATH="<some_path>:$PATH"
in any of above files are not visible to Emacs.
This behavior is same when I connect to emacsclient
from terminal.
I'm using emacs --deamon
on startup.
.profile
are visible to Emacs, because.profile
is loaded when your session starts. Where did you add the “missing” elements? If it's.bashrc
, just don't do that. – Gilles 'SO- stop being evil' Jul 22 '15 at 21:04export PATH
commands listed in~/.profile
However, when I startansi-term
mode, only my.bashrc
file is read (so nothing is added to my PATHs). This is different than when I have a shell outside of emacs. How can I force ansi-term to read .profile or should I useexec-path-from-shell
? – Startec Jan 30 '17 at 7:59.profile
is supposed to be read only when you log in, not whenever you start a new shell. There must be a misconfiguration in the way you start a shell outside Emacs, that forces the shell to be a login shell. – Gilles 'SO- stop being evil' Jan 30 '17 at 9:33PATH elements added in .profile are visible to Emacs, because .profile is loaded when your session starts
but it looks like they are not in my case (and in the OP case). Do I really have to useexec-path-from-shell
just to make the$PATH
available to emacs ans ansi-term exactly the same as the one to available to bash outside of emacs? – Startec Jan 30 '17 at 19:20