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

前端 未结 5 1382
予麋鹿
予麋鹿 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:42

    Turns out this is answered by this question:

    How can I ssh directly to a particular directory?

    to ssh:

    ssh -t anvil "export V=hello; export W=world; bash"
    

    followed by:

    jla@anvil$ echo $V $W
    hello world
    

提交回复
热议问题