远程到服务器并使用管道以分离模式运行 tmux

问题描述 投票:0回答:1

我正在尝试使用 ssh 远程连接到服务器,并使用分离模式下的命令在远程服务器上运行 tmux。我想在 tmux 中运行的命令需要管道字符。

我尝试过逃避 |带有 \ 的字符,但这似乎并没有做到。

我当前的命令:

ssh [email protected] -C tmux -s -d MySession 'nc -l 10000 | zfs receive tank/remotepool'
linux bash ssh pipe tmux
1个回答
1
投票

将整个远程命令放在引号中,以便正确处理嵌套的带引号的字符串。

ssh [email protected] -C "tmux -s -d MySession 'nc -l 10000 | zfs receive tank/remotepool'"
© www.soinside.com 2019 - 2024. All rights reserved.