Let's say I want to execute several commands with similar flags such as:
du -sh / --exclude=/dir1 --exclude=/dir2 --exclude=/dir3/dir4 tar cvf archive / --exclude=dir1 --exclude=dir2 --exclude=dir3/dir4
I want to reuse the sequence of
--exclude flags and make the code more clean by e.g. saving these flags to a variable.
So afterwards above commands look like
du -sh / "$EFLAGS" tar cvf archive / "$EFLAGS"
tar excludes files and directories relative to the given directory.
What is the best and cleanest solution?
I want to backup my system using tar and exclude some directories that I don't need.