【问题标题】:ssh to Ubuntu Server, run some commands, and then leave myself the default prompt?ssh 到 Ubuntu 服务器,运行一些命令,然后让自己保持默认提示?
【发布时间】:2017-02-04 23:02:16
【问题描述】:

正如here 所讨论的,我们可以通过 SSH 远程访问 Ubuntu Server 实例,然后运行命令并打开提示符

ssh -t host 'cmd1; cmd2; sh -i'

虽然我在我的 Ubuntu 服务器上得到的 shell 提示不是默认的,即当我尝试运行 ~ ./bashrc 时,我得到如下快照的错误。

所以我需要的是

ssh -t host 'cmd1; cmd2; OPEN_DEFAULT_PROMPT'

OPEN_DEFAULT_PROMPT 将在cmd1; cmd2 之后打开默认的 Ubuntu Server shell 提示符。

【问题讨论】:

标签: shell ssh ubuntu-server startupscript


【解决方案1】:

只是bash 而不是sh -i

ssh -t host 'cmd1; cmd2; bash'

【讨论】:

    猜你喜欢
    • 2012-03-07
    • 2019-05-18
    • 2014-05-13
    • 2014-05-04
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 2012-11-17
    相关资源
    最近更新 更多