1

I have a problem with rsync when I pass the exclude list in curly braces, what is the difference between the following two lines?

sudo rsync -aHAXxhvi --delete --exclude={/1111111/} /etc/ /media/destino/etc/

sudo rsync -aHAXxhvi --delete --exclude={/1111111/,} /etc/ /media/destino/etc/

With the first one, the directory /etc/111111 is copied, the exclude does not work and with the second one it is not copied, the only difference is the comma.

Is this the expected behavior?

Greetings.

1 Answers1

0

Curly braces are expanded by your shell (bash/zsh), not by rsync. (For example, if you have a two-item list, the shell expands it to two separate "--exclude=" options.)

Yes, in shell syntax, brace expansion only happens if there are at least two elements:

A correctly-formed brace expansion must contain unquoted opening and closing braces, and at least one unquoted comma or a valid sequence expression. Any incorrectly formed brace expansion is left unchanged.

grawity
  • 501,077