]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
bin/srsync-incremental: Improve --link-dest search.
authorSimon Ruderich <simon@ruderich.org>
Sat, 7 Dec 2013 20:22:15 +0000 (21:22 +0100)
committerSimon Ruderich <simon@ruderich.org>
Sat, 7 Dec 2013 20:22:15 +0000 (21:22 +0100)
bin/srsync-incremental

index 909c028802032b5679321c7dcc53e0a83518c1a2..16aa88a0215f3db4cb4d231bc212bbf3bd783135 100755 (executable)
@@ -34,11 +34,11 @@ fi
 cd "$1" || exit 1
 shift
 
-dest=`echo backup-*`
-if test "x$dest" != 'xbackup-*'; then
-    # -F and grep is used to list only directories, zsh's *(/) would be great.
-    dest="`pwd`/`ls -1dF backup-* | grep / | tail -n1`"
-fi
+# Get absolute path to last backup directory.
+for x in backup-*; do
+    test -d "$x" || continue
+    dest="../$x" # relative to destination directory
+done
 
 target=backup-`date '+%Y-%m-%d-%H-%M-%S'`