2012-06-12 20 views

回答

17

这工作:

mosh $REMOTE tmux attach # I didn't expect this to work 

但这些都不做:

mosh $REMOTE "tmux attach -d" # This should probably work 
mosh $REMOTE tmux attach -d # This correctly interprets -d as a mosh option 

更新:由于克里斯 - 约翰逊所指出的,你可以使用 ' - ' 的说法关闭选项处理,所以整个tmux命令作为命令发送到远程服务器:

mosh $REMOTE -- tmux attach -t 0 -d 
+2

我不是* mosh *用户,但[* mosh *网页](http://mosh.mit.edu/#usage)表明适当的语法可能是'mosh $ REMOTE - attach -d' (或'mosh - $ REMOTE attach -d')。 * mosh *是一个使用[GetOpt :: Long](http://perldoc.perl.org/Getopt/Long.html)的Perl程序。它的文档描述了[how'--' works](http://perldoc.perl.org/Getopt/Long.html#Mixing-command-line-option-with-other-arguments)。任何* mosh *选项都必须放在'--'之前。 –

+0

我忘了那个。这确实可以解决问题。 – chepner

+0

另一个使用非默认ssh端口的例子:'mosh --ssh =“ssh -p 822”ed8 @ vm-ed - tmux attach -t irc'。主机名是'vm-ed' –