在远程主机上运行自定义配置文件 [英] Running a custom profile file on remote host
本文介绍了在远程主机上运行自定义配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在远程主机上有一个自定义配置文件脚本.当我自动连接到主机时,我想获取它.我无法更改远程主机上的任何内容.我尝试过但没有奏效的事情:
I have a custom profile script on a remote host. I'd like to source it when I connect to the host automatically. I cannot change anything on the remote host. Things I've tried but didn't work:
ssh -t myhost '. /local/scratch/scripts/rtc_profile ; bash -l'
ssh -t myhost 'bash -l /local/scratch/scripts/rtc_profile'
我也尝试了以下(有效),但它跳过了所有其他 rcfiles:
I've also tried the following (which works), but it skips all other rcfiles:
ssh -t myhost 'bash --rcfile /local/scratch/scripts/rtc_profile '
请帮忙:)
推荐答案
您可以将以下内容放在 ~/.bashrc
的末尾:
You can put the following at the end of your ~/.bashrc
:
if [ ! -z "$SSH_CONNECTION" ] ; then
source /local/scratch/scripts/rtc_profile
fi
这篇关于在远程主机上运行自定义配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文