From: DecaTec Date: Wed, 6 Jan 2021 10:16:17 +0000 (+0100) Subject: Remove trailing slash when dir is given by parameter X-Git-Tag: v2.1.1~4 X-Git-Url: https://git.p6c8.net/nextcloud-backup-restore.git/commitdiff_plain/371fa270c89ef7cb2929578394ea28c70cd9ff05?ds=inline;hp=c43441d1af3f9dbc7c6c85cb198eba6c29416a57 Remove trailing slash when dir is given by parameter --- diff --git a/NextcloudBackup.sh b/NextcloudBackup.sh index a0299e6..5606883 100644 --- a/NextcloudBackup.sh +++ b/NextcloudBackup.sh @@ -24,6 +24,8 @@ backupMainDir=$1 if [ -z "$backupMainDir" ]; then # TODO: The directory where you store the Nextcloud backups (when not specified by args) backupMainDir='/media/hdd/nextcloud_backup' +else + backupMainDir=$(echo $backupMainDir | sed 's:/*$::') fi currentDate=$(date +"%Y%m%d_%H%M%S")