From c896c1b25d80efab079c9940c4459215a53f3314 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 31 Oct 2016 22:20:51 +0000 Subject: [PATCH] backupcount=0 by default Previous solution 1a5fc1471b95e551301aa6064e525c3c842dd672 caused issue with the find command showing an error. --- lgsm/functions/info_distro.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 4b07d537b..16973cfc1 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -114,10 +114,14 @@ if [ -d "${backupdir}" ]; then if [ -z "${backupdirdu}" ]; then backupdirdu="0M" fi - # number of backups. - backupcount=$(find "${backupdir}"/*.tar.gz | wc -l) + + # number of backups set to 0 by default + backupcount=0 + # If there are backups in backup dir. if [ $(find "${backupdir}" -name "*.tar.gz" | wc -l) -ne "0" ]; then + # number of backups. + backupcount=$(find "${backupdir}"/*.tar.gz | wc -l) # most recent backup. lastbackup=$(ls -t "${backupdir}"/*.tar.gz | head -1) # date of most recent backup.