Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building a shell script and at some point I'm excecuting thie command :

rsync -arv --delete --exclude=".svn,*.db,.DS_Store" Source/ Dest/

However it seems the my exclusion doesn't work. Am I doing something wrong? With a direct command in terminal it works. Perhaps the problem comes from " "

share|improve this question
up vote 1 down vote accepted

Perhaps the problem comes from " "

The shell expands metacharacters in doubly-quoted strings and then passes the reult to the actual command (it's actually more complicated than this)

Try using single quotes.

--exclude=".svn,*.db,.DS_Store"

Are you sure the PATTERN in -exclude=PATTERN can be a comma-separated list? I'd try splitting it into multiple -exclude options

share|improve this answer
    
splitting is the good solution : --exclude=./svn --exclude=*.db ... Thx ! – Pierre Dec 6 '12 at 21:38
    
The shell does NOT expand wildcards in double-quoted strings. The only thing it expands are variables, commands substututions, and arithmetic substitutions. – Barmar Dec 24 '15 at 16:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.