I read this in tramp manual and tried it.
Added
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
Then exited emacs, removed ~/.emacs.d/tramp
, and restarted as explained here
But M-! echo $PATH
still shows the value of tramp-default-remote-path
instead of the value set in my .bashrc
.
The issue looks to be my understanding of how profiles are loaded.
The way tramp calls the remote shell to get the remote PATH:
/bin/sh -l -c 'echo $PATH'
/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
Since bash is call as login shell and as /bin/sh
it reads .profile
instead of .bash_profile
or .bashrc
.
I found this in bash manual page:
If bash is invoked with the name sh, it tries to mimic the startup behavior of
historical versions of sh as closely as possible, while conforming to the
POSIX standard as well. When invoked as an interactive login shell, or a
non-interactive shell with the --login option, it first attempts to read and
execute commands from /etc/profile and ~/.profile, in that order. The
--noprofile option may be used to inhibit this behavior. When invoked as an
interactive shell with the name sh, bash looks for the variable ENV, expands
its value if it is defined, and uses the expanded value as the name of a file
to read and execute. Since a shell invoked as sh does not attempt to read and
execute commands from any other startup files, the --rcfile option has no
effect. A non-interactive shell invoked with the name sh does not attempt to
read any other startup files. When invoked as sh, bash enters posix mode
after the startup files are read.
I usually configure only ~/.bashrc
and ~/.bash_profile
For tramp to work properly looks like I should move my .bash_profile
to .profile
Hope this helps others.
- GNU Emacs: 25.0.94.2 Tramp: 2.2.13.25.1
tramp-remote-path
that actually has any effect on the path. – Myrta