Tricky Quoting Issue in BASH

Andy Bradford amb-plug at
Sun Jan 1 14:53:34 MST 2006

Thus said Charles Curley on Sun, 01 Jan 2006 12:49:52 MST:

> I'd  like to  run an  rsync  command to  do backups,  with an  exclude
> pattern. I  can build what looks  like a perfectly good  command, echo
> it, then  run it. But  the exclude pattern  is ignored. However,  if I
> copy the echoed command line and execute it directly, it works and the
> exclude pattern is respected.

While I realize this doesn't exactly address the quoting problem, I have
found -C to be a very useful option to handle this kind of thing. Simply
place a .cvsignore file  with the items you want excluded  at the top of
the tree  in which  you have exclusions  and -C does  all the  rest. For
example, to ignore a subtree called bar under foo:

$ find /foo

$ echo 'bar' > /foo/.cvsignore

Now calling rsync with -C will ignore /foo/bar when backing up /foo

[-----------[system uptime]--------------------------------------------]
  2:53pm  up 37 days,  4:21,  2 users,  load average: 0.00, 0.00, 0.00

More information about the PLUG mailing list