Tmux send-keys stripping space

I'm trying to run a series of commands in tmux from a remote file like so:

tmux $(wget -qO- http://example.com/tmux)

The file contains commands like split-window and send-keys

The problem is, send-keys is stripping spaces. The send-keys commands is:

send-keys ssh example.com C-m;

But instead it sends sshexample.com

Any idea why?

Cheers!


As a guess, it's interpreting "send-keys ssh example.com C-m;" as four separate arguments and not knowing what to put between them.

Try:

tmux "$(wget -qO- http://example.com/tmux)"

It is not that send-keys is "stripping spaces" exactly, but that Space is one of the special keys recognized by tmux and expected to be used with the send-keys command.

So, rather than

send-keys ssh example.com C-m;

in this case, you would use

send-keys ssh Space example.com C-m;

More on this can be found on tmux send-keys syntax