You are not logged in.
Hello,
probably very simple problem, but obviosly not for me:
rsync -av --exclude-from=- source targetreads the exclude list from stdin. How can I define this include list within my script and put in on stdin for rsync:
EXCLUDE="
~/Musik
~/.cache
"
rsync -av --exclude-from=- source target <<< "$EXCLUDE"But that doesn't work...
Thanks!
Offline
rsync -av --exclude-from=- source target < <(echo "$EXCLUDE")or
rsync -av --exclude-from=<(echo "$EXCLUDE") source targetI might try an EXCLUDE array and do
rsync -av --exclude-from=<(printf "%s\n" "${EXCLUDE[@]}") source targetI doubt any of this is 'best practice' though, and maybe this is an XYZ problem. Why are your excludes in a variable like that?
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
Why are your excludes in a variable like that?
In order to name multiple excludes for rsync you either have to use "--exclude=foo --exclude=bar --exclude=snafu ..." or --exclude-from=file. I deem the latter the most comfortable if I want to add or remove exclude patterns. Of course I could use a temp file too.
Offline
EXCLUDE="
~/Musik
~/.cache
"
rsync -av --exclude-from=- source target <<EOF
$EXCLUDE
EOFOffline