From 6377ad5281f31b71f26f8205130ac552a6d2cbef Mon Sep 17 00:00:00 2001 From: Andrea Richiardi Date: Mon, 13 Nov 2017 21:11:50 -0800 Subject: [PATCH] Use regex for trimming file:// destinations A problem with cut was causing: $ DEST="file:///media/user/data" $ TMPDEST=$(echo "${DEST}" | cut -c 6-) $ echo $TMPDEST ///media/user/data The fix uses a regex instead so that we trim away things correctly. It also seems somewhat more readable. --- duplicity-backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 57e52a4..c3c45d2 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -650,7 +650,7 @@ get_remote_file_size() ;; "fi") FRIENDLY_TYPE_NAME="File" - TMPDEST=$(echo "${DEST}" | cut -c 6-) + TMPDEST="${DEST#file://*}" SIZE=$(du -hs "${TMPDEST}" | awk '{print $1}') ;; "gs")