bash – New line \n is replaced with \#012

I have created a small alias function to sync my scripts.

It worked fine until last week but now in my rsync command it doesn’t do the newlines anymore. They are replaced by \#012

rsync: failed to open exclude file .DS_Store\#012GitHub_public/\#012Scrips....

If I do echo $exclude_files all is fine, I have every exclude fine in each line

.DS_Store
GitHub_public/
Scripts/.DS_Store

I have the same behaviour on both my computers and I am unable to find out where it comes from. I have removed my .zshrc if it was an extension that created the bug but no change.

function rsyncScripts() {

    computer_name=$(scutil --get ComputerName | tr '[:upper:]' '[:lower:]')
    SRC="$HOME/Developer"
    exclude_files=$(git -C $SRC ls-files --exclude-standard -oi --directory)

    if ! [[ "${computer_name}" =~ "yyyyyy" ]]; then
        DEST="$HOME/Library/CloudStorage/[email protected]/Mon Drive/Developer/pro"
    else
        DEST="$HOME/Library/CloudStorage/[email protected]/Mon Drive/Developer/perso"
    fi

    rsync -azP --exclude-from="$exclude_files" "$SRC" "$DEST"

}

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: