-e escape rule

Joe josephj at main.nc.us
Sun Nov 20 20:17:35 UTC 2016

On 11/20/2016 02:55 PM, Francis.Montagnac at inria.fr wrote:
> Hi
> On Sun, 30 Oct 2016 20:06:00 +1300 Samuel Williams wrote:
>> But it's also a surprise that backslash escape sequences don't work
>> according to intuition of how commands are normally executed. If you
>> supplied the string in -e to system, it would work as expected..
>> Unfortunately, this is the default when using Shellwords.join in Ruby.
>> So, I had to write a custom RSync "join" function to produce an
>> appropriate command for -e argument.
> I guess you are building from ruby a single string for the whole rsync
> command, and that you give it to the system ruby command.
> If this is it, it would be simpler to build instead an array of
> strings and to call system with this array as arguments.
> This way, ruby will call directly rsync without calling an extra shell
> and you will not have to re-quote the arguments, in particular the one
> for -e.
> Francis
A couple of years ago I was having somewhat similar problems building an 
rsync command in bash and someone on this list suggested exactly the 
same solution. It really makes things simpler - and easier to read/maintain.


More information about the rsync mailing list