I am trying to edit a backup script so it will work for me. My issue is that if I set the directory path I wish to backup, then it would also backup the directory containing the backups :) The script: https://github.com/todiadiyatmo/bash-backup-rotation-script/blob/master/backup_rotation.shcurrently most of my allocated space is in /homeroot@encorepvp:/home/jo# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/root        20G  2.3G   16G  13% /devtmpfs         32G  4.0K   32G   1% /devnone            4.0K     0  4.0K   0% /sys/fs/cgroupnone            6.3G  1.5M  6.3G   1% /runnone            5.0M     0  5.0M   0% /run/locknone             32G  4.0K   32G   1% /run/shmnone            100M     0  100M   0% /run/user/dev/md3        1.8T   29G  1.7T   2% /homeI have a dir in /home called backups so I am looking to omit that directory from the backup using say -x /home/backups  How would I go about implementing this? 
How to omit directory from backup
backup
I have a dir in /home called backups so I am looking to omit that directory from the backup using say -x /home/backups. How would I go about implementing this?To go about implementing this you would look through the script and discover the relevant lines for making the directory backup:# Compress tables and filescd $TARGET_DIRtar -czf $BACKUP_DIR/backup.incoming/$backup_filename -C $BACKUP_DIR/backup.incoming/ mysql_dump.sql $TARGET_DIRYou would discover that it uses tar, so you would look up the man page for tar and determine that the exclude option is --exclude rather than x. You would then apply the changes to the file and test it.Rather than excluding a fixed directory it would make sense - in the context of the script - to use the variable that declares the backups directory, $BACKUP_DIR.tar -czf $BACKUP_DIR/backup.incoming/$backup_filename -C $BACKUP_DIR/backup.incoming/ --exclude $BACKUP_DIR mysql_dump.sql $TARGET_DIRWhile you were editing the script, it would be even better if you were to (trivially) modify large parts of the script so that it could cope with directory names containing whitespace and other strangenesses. You would do this by quoting most of the variables. For example, the tar section would become this:# Compress tables and filescd $TARGET_DIRtar -czf $BACKUP_DIR/backup.incoming/$backup_filename -C $BACKUP_DIR/backup.incoming/ --exclude $BACKUP_DIR mysql_dump.sql $TARGET_DIR