Skip to content

Commit

Permalink
Use regex for trimming file:// destinations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arichiardi committed Nov 14, 2017
1 parent dba25a5 commit 6377ad5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion duplicity-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 6377ad5

Please sign in to comment.