Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using rsync on Ubuntu 12.04 LTS with the following script to back up all of /, however, whenever I run the script (as root), the directory /backup is included, when it should be excluded:

#!/bin/sh
rsync --password-file=/etc/rsyncd.password --delete -aAXzv --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,/home/*/Downloads/*,/backup/*,/var/spool/squid3,/opt/atlassian,var/www/\~*} /* fsbak@servername::fsbak

Why is this happening, and how can I make rsync ignore /backup?

share|improve this question
    
/backup/* <- So rsync backs the content of the directory up as well and not just the directory itself? –  superuser0 Apr 12 '13 at 16:41
    
Are the rest of the directories excluded correctly? –  terdon Apr 12 '13 at 17:22
add comment

1 Answer

up vote 1 down vote accepted

Changing #!/bin/sh to #!/bin/bash in the script has fixed this issue. The curly brace expansion used in the script is a bash feature and, as such, is not available in sh.

share|improve this answer
add comment

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.