I've been reading about quotes in bash here and everywhere else, but i got no help solving this problem.
The thing is, I have a little script for doing backups in a loop.
If I don't use eval
then I have problems with $OPTIONS
variable in rsync
.
But if I do use eval
then the problem goes to the variable $CURRENT_DIR
...
rsync returns the following message: 'Unexpected local arg: /path/with'
I've tried every way of quoting the variable $CURRENT_DIR
CURRENT_DIR="/path/with spaces/backup"
DIR="dir_by_project"
f=":/home/project_in_server"
OPTIONS="-avr --exclude 'public_html/cms/cache/**' --exclude 'public_html/cms/components/libraries/cmslib/cache/**' --delete"
eval rsync --delete-excluded -i $OPTIONS [email protected]$f $CURRENT_DIR/xxx/$DIR/files
Is there any way that i can use the variable $CURRENT_DIR
without problems caused by spaces?