help required for passing parameters to rsync within a script

michael cs at
Wed Sep 24 17:14:12 GMT 2008

On Tue, 2008-09-23 at 20:39 -0400, Matt McCutchen wrote:
> On Tue, 2008-09-23 at 22:22 +0100, michael wrote:
> > I'm attempting to write a short script to copy all 'CONC*' files in any
> > subdir under ./ using rsync and filters but I can't get the correct
> > quoting/escaping... any ideas?
> > # filter: all subdirs but only CONC* files
> > FILTER="--filter=+ \* --filter=+ CONC\* --filter=- \*"
> > echo $FILTER
> > set -x
> The trouble is that, when you expand ${FILTER} outside of double quotes,
> bash will split on all spaces in the value, which cuts each filter rule
> in two.  To fix this, you can use an underscore instead of a space to
> separate the +/- symbol from the pattern, or you can switch to bash
> arrays as shown here (but omit the colon before "${COMMAND[@]}" !):

aha, the underscore, rather than space, for +/- helped (missed that in
the doc before... esp since there's no examples with it!)


More information about the rsync mailing list