我需要使用该subprocess模块在 ssh 会话中执行多个 shell 命令。我可以一次执行一个命令:
subprocess.Popen(["ssh", "-o UserKnownHostsFile=/dev/null", "-o StrictHostKeyChecking=no", "%s" % <HOST>, <command>])
Run Code Online (Sandbox Code Playgroud)
但是有没有办法subprocess在 ssh 会话中执行多个 shell 命令?如果可能,我不想使用包。
非常感谢!