From 0439d8a899f646a6ff342d522af8928c63454d89 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Fri, 30 Sep 2022 10:22:29 +0200 Subject: [PATCH] backupdir defini au debut --- backup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backup.sh b/backup.sh index ed31ba6..755a6b6 100644 --- a/backup.sh +++ b/backup.sh @@ -18,6 +18,8 @@ if [ $UID -ne 0 ] ; then exit 1 fi +backupdir=/var/backups/$(date -I) + while getopts hl OPTION ; do case $OPTION in (l) listBackups ${backupdir}/.. ; ;; @@ -26,9 +28,8 @@ while getopts hl OPTION ; do esac done -shift $((OPTIND -1)) +shift $(( OPTIND - 1)) -backupdir=/var/backups/$(date -I) mkdir -p $backupdir || myerror 2 "impossible de créer $backupdir" for dir in "$@" ; do