zertrin / duplicity-backup.sh

Bash wrapper script for automated backups with duplicity supporting Amazon's S3 online storage as well as other storage destinations (ftp, rsync, sftp, local storage...).
https://zertrin.org/projects/duplicity-backup/
GNU General Public License v3.0
766 stars 187 forks source link

Use regex for trimming file:// destinations #168

Closed arichiardi closed 7 years ago

arichiardi commented 7 years ago

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.

zertrin commented 7 years ago

I don't know why this hasn't been spotted before but I like the solution. Thanks!