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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With