I'm trying to write a simple net/rsync backup shell script, but I'm having problems with wildcards and escape characters.
There is one line in my script which is causing all the problems, yet it works fine from the console. Essentially, I'm trying to copy my dotfiles and hidden folders from:
home/user/ to home/user/backups/dotfiles.
Here is the command:
When used in a script, rsync seems to ignore the escape character and will include all my top level home directories, along with /home/user/backups/ in the source directory, which leads to another backup folder in my backup destination, recursively on, forever, i.e. I end up with: /home/user/backups/dotfiles/backups/dotfiles/backups/dotfiles/...
I've tried using quotes, full paths, and many variations of both, but the script will not behave as it does on the command line (many of the variants worked well from the command line). What am I missing here?
There is one line in my script which is causing all the problems, yet it works fine from the console. Essentially, I'm trying to copy my dotfiles and hidden folders from:
home/user/ to home/user/backups/dotfiles.
Here is the command:
# rsync -avzu --delete --delete-excluded --exclude-from=/home/user/.rsync.exclude ~/\.* ~/backups/dotfiles
When used in a script, rsync seems to ignore the escape character and will include all my top level home directories, along with /home/user/backups/ in the source directory, which leads to another backup folder in my backup destination, recursively on, forever, i.e. I end up with: /home/user/backups/dotfiles/backups/dotfiles/backups/dotfiles/...
I've tried using quotes, full paths, and many variations of both, but the script will not behave as it does on the command line (many of the variants worked well from the command line). What am I missing here?