Skip to main content
5 of 7
Rollback to Revision 3
user avatar
user avatar
mix(){
        p=$1; shift; q=$1; shift; c=
        i=1; for a; do c="$c $q \"\$$i\""; i=$((i+1)); done
        eval "${p%\%*}$c${p#*\%}"
}
mix 'tar % -zcf tmp.tar.gz' --exclude "/tmp/hello hello" "/tmp/systemd*" "/tmp/Temp*"

EXCLUDE=("/tmp/hello hello" "/tmp/systemd*" "/tmp/Temp*")
mix 'tar % -zcf tmp.tar.gz' --exclude "${EXCLUDE[@]}"

Extending the answer here

user313992