使用ssh的Tramp不会提供.bash_profile/.profile

Jul*_*ian 7 emacs bash aquamacs tramp

我正在使用Aquamacs(使用emacs 24和tramp 2.2.3版的OSX图形化emacs)来编辑远程服务器上的一些文件.Tramp设置为使用ssh并在编辑文件方面工作正常.

它在编译时失败,因为编译器不在路径中.似乎tramp不会提供任何配置文件,如.profile.bash_profile./ bin/sh是/ bin/bash的链接,所以bash应该是tramp使用的shell.在远程服务器上的emacs内启动的shell也不会提供任何内容.来自常规终端仿真器(在OS X上尝试过的终端X11)的ssh连接按预期工作(一切来源正确).

有任何想法吗?

suv*_*ayu 5

/bin/sh 是 /bin/bash 的链接,因此 bash 应该是 trap 使用的 shell。

这是不一样的。当作为“sh”调用时,它的行为类似于 sh 而不是 bash,因此不会获取 bash 特定的 rc/profile 文件(例如 ~/.bash_profile、~/.bashrc)。但是 ~/.profile 将被读取。您的问题可能是您正在使用 bash 语法在 ~/.profile 中设置内容。

这是行不通的:

export PATH=/some/path:$PATH
Run Code Online (Sandbox Code Playgroud)

但这会:

PATH=/some/path:$PATH
export PATH
Run Code Online (Sandbox Code Playgroud)

  • 就我而言,.profile 被完全忽略。在调用 /bin/sh 时手动获取它实际上确实会产生正确的路径,但其自身的流浪似乎不会获取〜/.profile。 (8认同)