Jump to content

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


Recommended Posts

Guest JoeS
Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...