From 6947a63fe3b804e175a532442f05bbc65c1ce3ae Mon Sep 17 00:00:00 2001 From: Laborratte5 <49961317+Laborratte5@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:22:59 +0200 Subject: [PATCH] fix: exit code on error Return non negative exit codes on error --- backup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup.sh b/backup.sh index 94c7a76..bc4aa11 100755 --- a/backup.sh +++ b/backup.sh @@ -30,7 +30,7 @@ DRIVE_CKSUM=$(dd if=$DRIVE_TO_BACKUP | cksum) diff <(echo $DRIVE_CKSUM) <(cat $BACKUP_MNT/$CHECKSUM_FILE) if [ $? -ne 0 ]; then echo -e "\e[1;41m Backup not consistent! \e[0m" - exit -1 + exit 1 fi # Recalculate checksums @@ -40,7 +40,7 @@ IMG_CKSUM=$(dd if=$BACKUP_MNT/$DEVICE_NAME.img | cksum) diff <(echo $IMG_CKSUM) <(cat $BACKUP_MNT/$CHECKSUM_FILE) if [ $? -ne 0 ]; then echo -e "\e[1;41m Backup not consistent! \e[0m" - exit -1 + exit 1 fi umount $BACKUP_LOCATION