fredag 6 februari 2015

Linux - Bash rsync using variables

"The above script is useful, but it has hard-coded paths.
That might not be a problem, but if you want to write longer
scripts that reference paths often, you probably want to
utilize variables. Here's a quick sample:"

#!/bin/bash  # rsync using variables    SOURCEDIR=/home/user/Documents/  DESTDIR=/media/diskid/user_backup/Documents/    rsync -avh --exclude="*.bak" $SOURCEDIR $DESTDIR

    

Inga kommentarer: