Can I ssh somewhere, run some commands, and then leave myself a prompt?

前端 未结 5 1384
予麋鹿
予麋鹿 2020-11-29 04:56

I find myself needing to log into various servers, set environment variables, and then work interactively.

e.g.

$ ssh anvil
jla@anvil$ export V=hello         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 05:49

    Another approach is to execute this beast (also gives me a colored shell):

    ssh host -t "echo 'rm /tmp/initfile; source ~/.bashrc; cd foo/; git status' > /tmp/initfile; bash --init-file /tmp/initfile"

提交回复
热议问题