Skip to content

Commit 661ffaf

Browse files
committed
Fix errors when listing db backups when none exist
1 parent 7a95a55 commit 661ffaf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bin/tdb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,9 @@ fi
249249
if [[ "$action" == 'list' ]]; then
250250
echo -e "\x1B[2mListing $db_type backups in ${backup_folder_local}\x1B[0m"
251251
(
252-
files=( "$backup_folder_local"/*.${db_type} "$backup_folder_local"/*.dump)
253-
[ -e "${files[0]}" ] || { echo "No $db_type backups found" >&2; exit 0; }
252+
shopt -s nullglob
253+
files=( "$backup_folder_local"/*.${db_type} "$backup_folder_local"/*.dump )
254+
[ ${#files[@]} -eq 0 ] && { echo "No $db_type backups found" >&2; exit 0; }
254255

255256
printf "Name\t\tDate\t\tSize\n"
256257
for f in "${files[@]}"; do

0 commit comments

Comments
 (0)