Question

I'm using Mosh with tmux

I want to run the command "tmux attach -t 0 -d" after mosh connects successfully.

How do I automatically call a command to reattach tmux when I successfully log via mosh?

Était-ce utile?

La solution

This works:

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

but neither of these do:

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

UPDATE: As Chris Johnson points out, you can use the '--' argument turn off option processing, so that the entire tmux command is sent to the remote server as a command:

mosh $REMOTE -- tmux attach -t 0 -d
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top