In my bash script, in several places I need to run the command
rsync [stuff] --exclude={"/mnt/*","/proc/*"} [source] [destination]
To avoid typing out the whole list, I want to pack the option --exclude={"/mnt/*","/proc/*"} into a variable called EXCLUDES such that I can type in my script:
rsync [stuff] "$EXCLUDES" [source] [destination]
What is the proper way to achieve this?
EXCLUDES='--exclude={"/mnt/*","/proc/*"}'$EXCLUDEScan expand into something which contains quotation marks; these are not processed in relation to the quotes around"$EXCLUDES". The$VARsyntax cannot perpetrate a "close quote injection attack" against the surrounding syntax.