我的问题是我需要设置几个变量,并且每次登录ssh shell时输出几行,同时我必须能够使用sftp通过Filezilla tarnsfer文件。
现在,根据http://www.openssh.org/faq.html 上的 openssh 常见问题解答,如果您的启动脚本回显任何类型的输出,它就会与 sftp 混淆。因此,它要么无限期地延迟,要么因“连接被服务器关闭,退出代码为 128”而出错。
我尝试过将 .bashrc 移动到 .bash_profile 或在 .bashrc 中使用以下代码的解决方案:
if [ "$TERM" != "dumb" ]
then
source .bashc_real
fi
Run Code Online (Sandbox Code Playgroud)
和:
if [ "$TERM" = "xterm" ]
then
source .bashc_real
fi
Run Code Online (Sandbox Code Playgroud)
但是,没有任何效果。我的 shell 终端是 bash,我使用 filezilla 连接到 sftp。