suggestion for rsync syntax/quoting issue

Scott Francis darkuncle+lists-rsync at darkuncle.net
Thu May 8 05:39:24 GMT 2008


http://www.mail-archive.com/rsync@lists.samba.org/msg21380.html

I ran into the same issue a few years ago, solved it, forgot the solution and
then rediscovered it this evening. I think my solution is actually a little
simpler and easier to follow than the arrays proposed by a couple of other
list members, so I thought I'd pass it on. I'm not subscribed to the list, but
it looks like non-subscribers can still post (if this gets bounced, I guess I
will know I was incorrect in that assessment!) ...

----
#!/bin/sh
HOST=machine1
MIRROR=machine2
SRCDIR=/path/to/data
DSTDIR=/backups/path/to/data
SSH='/usr/bin/ssh -c blowfish'
RSYNC='/usr/bin/rsync -Lavz'
$RSYNC -e "$SSH" $HOST:$SRCDIR $MIRROR:$DSTDIR
----

I'm sure you've probably solved it and moved on, but I wanted to pass this on
anyway in the hopes that it's useful (or at least interesting :)). You can
wrap other problematic arguments in the same way as $SSH above and pass them
as well. As of version 3.0.0, rsync supports a -s flag that supposedly
mitigates some or all of these kinds of issues by bypassing remote shell
interpolation altogether. Dunno how well it works, because I haven't had a
chance to test with 3.x yet.

cheers,
-- 
       Scott Francis | darkuncle(at)darkuncle(dot)net | 0x5537F527
                        Less and less is done
                     until non-action is achieved
             when nothing is done, nothing is left undone.
                                    -- the Tao of Sysadmin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/rsync/attachments/20080507/d2df6446/attachment.bin


More information about the rsync mailing list