tar --exclude with curly braces

view full story

http://www.unix.com – I'm having trouble understanding the exclude option in tar. From some web sites, it seems one is able to exclude several strings by enclosing them in curly brackets. However it seems to be "random" what gets excluded when using the curlies. I've been using the exclude-from=myfile option in a script but would like to inline myfile into a variable and use $exclude={this,that,the_other} with the --exclude=$exclude option to keep the script self-contained. Simple examples to illustrate: Say I have directories C and D and want to make them into a tar file. tar -cvf mytar.tar C D This (HowTos)