
這工作正常,但不會~/.bash_profile
在 server2 上加載我的。為什麼?
$ ssh -A -t server1 ssh -A -t server2 bash -c "screen -dR"
答案1
從bash
man
頁面:
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist. This may be inhibited by using the --norc option.
The --rcfile file option will force bash to read and execute commands
from file instead of /etc/bash.bashrc and ~/.bashrc.
您可以重新附加到正在執行的現有會話screen
(可能已經在執行bash
),這不需要登入 shell。或者您screen
使用新的互動式非登入 shell 建立一個新會話。僅登入 shell 進程.bash_profile
。
您bash
在命令列上指定的啟動screen
命令是完全不同的呼叫。