2012-06-12 22 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' –