I'll spare you the entire multi-line duplicity command, but what I want to know is if it's possible is to tidy up a series of arguments in a script like this:--exclude $2/${4:-__nosuchfiles__} --exclude $2/${5:-__nosuchfiles__} ...the key thing is that $4, $5,... are names which often contain spaces. The present formulation works, but at the expense of those ugly defaults to __nosuchfiles__ to exclude nothing if the set of exclusion criteria is smaller than the number of excludes passed. It's also a hack in that somebody conceivably might create a folder called __nosuchfiles__, and that there is a limit on the number of exclusions that it can handle.What I'd like, is to defineEXCLUDES='--exclude Path 1 --exclude Path 2'with as many --exclude as I need, none to lots, and then substitute $EXCLUDES into a duplicity command line like:duplicity $STUFF $EXCLUDES $SOURCE $DESTINATIONof course, it doesn't work when the excludes specify names containing spaces, and I can't work out any formulation for defining and using such a set of exclusions in the script itself. (Bonus points if any answer also handles EXCLUDES= to mean no excludes at all. )Yes, I know I could use duplicity's --exclude-filelist, but I'd like to know if there is a general solution that does not depend on the command conveniently being able to read a list of names from a file instead of from the command line. Note also the prefixing of $2/ to all exclusion paths.
How to do optional arguments that may be file names containing spaces
bash;shell script