我想这样执行脚本:
#!/bin/bash
# a ssh connection
ssh USER@HOST << EOF
COMMAND1
COMMAND2
COMMAND3
EOF
# here I should execute some commands locally
COMMAND4
COMMAND5
# here back to *the same* ssh connection
# how?
这可能吗?如果是的话,又如何?
答案1
接下来man ssh
将暂停会话,让您返回到本地主机~
。^Z
运行命令,然后输入fg
以返回 ssh 会话。