I want to put command option of rsync into a variable so I can reuse it for other rsync commands. Here is what I tried but it didn’t work.
roption="-a --recursive --progress --exclude='class' --delete --exclude='exclude' --exclude='.svn' --exclude='.metadata' --exclude='*.class'"
rsync "$roption" /media/CORSAIR/workspace ~/
Can any body help me figure out the problem?
Thanks,
Use shell arrays. They’re extremely useful if you want to form strings using escapes and have them be literally what is typed. Plus, security.
You can even add to them: