"-signs in rsync as well as in embedded ssh command

Peter van der Meer w.p.vandermeer at student.utwente.nl
Sat Oct 22 11:23:13 GMT 2005


Manuel López-Ibáñez wrote:

> Is it very complicated to use several -o before each option?
>
> If you try:
>
> rsync -e "ssh -o Port=22 -o ClearAllForwardings=yes -o 
> ConnectTimeout=5 target" myfile :/remote/path/
>
> It works perfectly!!
>
> However, is there any possible scenario where the argument of -e 
> should be interpreted by a shell?

The ProxyCommand option in ssh usually contains space-characters, so it would not work in your example.
Interpretation by a shell would solve this, but there are other possible sollutions as well.

> Anyway, does the shell would understand the nested quotes at all? If 
> not, then even if the -e argument is interpreted by a shell, it won't 
> make any difference in this case, will it? 

Lets take for example the next command on my interactive shell:
rsync -e "ssh -o \"ProxyCommand corkscrew myhttpProxy\"" testfile.txt targetcomputer.domain:receive

Then my shell will call rsync with the following parameters:
1 -e
2 ssh -o "ProxyCommand corkscrew myhttpProxy"
3 testfile.txt
4 targetcomputer.domain:receive

(Note that the shell uses and removes the "-signs and un-escapes the embedded \"-signs)
(Note that -e and the value are passed as 2 parameters, this is ok)

If rsync would give this command to another shell, then this shell would call ssh with parameters:
1 -o
2 ProxyCommand corkscrew myhttpProxy
3+ parameters from rsync to ssh (like hostname)

(Note that the shell uses and removes the "-signs.)
(Note that -o and the value are passed as 2 parameters, this is ok)
This should work.

But rsync will split the ssh command on spaces and call ssh with parameters:
1 -o
2 "ProxyCommand
3 corkscrew
4 myhttpProxy"
5+ parameters from rsync to ssh (like hostname)

(Note that -o option values is split over 4 parameters, ssh will not understand this.)
(Note that rsync ignores and passes the "-signs.)
This could not work, because ssh cannot understand the -o option.




More information about the rsync mailing list