Linux Certification, System Administration, Programming, Networking Books
Using rsync in a Script

I want to use rsync in a shell script. To get rsync to read 2 files the syntax requires a space separated list enclosed in single quotes e.g.
rsync -e ssh -avz root@server:'/etc/file1 /etc/file2' destination

However, I want to put in a shell script the following (basically)...

FILES='/etc/file1 /etc/file2'
rsync -e ssh -avz root@server:$FILES destination

It falls over :-(
I've tried..
FILES='/etc/file1 /etc/file2'
FILES="'/etc/file1 /etc/file2'"
and
FILES=''/etc/file1 /etc/file2''
and some variations but it won't work and I'm getting dizzy !
Obviously the '/etc/file1 /etc/file2' needs to be enclosed in something but I can't figure it. Tried Googling without success and can't find an example anywhere.

Hope someone can point me in the right direction - I'm a newbie to shell scripts & linux.
 

FILES='/etc/file1 /etc/file2'
for file in $FILES ; do
rsync -e ssh -avz root@server:$file destination
done

Quick Links:
Do you have a Linux Question?

Linux Home: Linux System Administration Hints and Tips