From 8531944907754cb3ecd56e0ddce36f2ec4e73f06 Mon Sep 17 00:00:00 2001 From: Mark Metcalfe Date: Mon, 22 Sep 2025 10:36:02 +1200 Subject: [PATCH] fix: Fix errors when listing db backups when none exist --- bin/tdb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/tdb b/bin/tdb index 1bafd1dd..2c6def58 100755 --- a/bin/tdb +++ b/bin/tdb @@ -249,8 +249,9 @@ fi if [[ "$action" == 'list' ]]; then echo -e "\x1B[2mListing $db_type backups in ${backup_folder_local}\x1B[0m" ( - files=( "$backup_folder_local"/*.${db_type} "$backup_folder_local"/*.dump) - [ -e "${files[0]}" ] || { echo "No $db_type backups found" >&2; exit 0; } + shopt -s nullglob + files=( "$backup_folder_local"/*.${db_type} "$backup_folder_local"/*.dump ) + [ ${#files[@]} -eq 0 ] && { echo "No $db_type backups found" >&2; exit 0; } printf "Name\t\tDate\t\tSize\n" for f in "${files[@]}"; do