[SOLVED] rsync backup script: how to use quotes?

  • Thread starter Thread starter JoeS
  • Start date Start date
J

JoeS

I want to use an rsync script to do backups. I'm not sure how to use regular expressions for OPT in the script and could use some help.
Quote:
This is the script I am using:
#!/bin/bash

# Flash backup script


#The source directory:
SRC="/home/joe/"

#The target directory:
TRG="/media/linux/joe/"

#The rsync options:
OPT="-av --numeric-ids --delete --delete-excluded --filter=merge /home/joe/bin/scripts/flash-filter-rule.txt"

#Execute the backup
rsync $OPT $SRC $TRG
This gave me an error:
joe@crunchbang:~/bin/scripts$ bash flash-backup.txt
unexpected end of filter rule: merge
rsync error: syntax or usage error (code 1) at exclude.c(901) [client=3.0.9]

I also tried quoting the OPT like this:
OPT="-av --numeric-ids --delete --delete-excluded --filter='merge /home/joe/bin/scripts/flash-filter-rule.txt'"
Unknown filter rule: `'merge'

and
OPT="-av --numeric-ids --delete --delete-excluded --filter=merge\ /home/joe/bin/scripts/flash-filter-rule.txt"
Unknown filter rule: `merge\'

How do I write this to merge in the filter rule file?

Thanks

Continue reading...
 
Back
Top