From 3df24ddaad72dd092225f99e35886d046fb01b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Wed, 31 Jan 2024 21:02:03 +0100 Subject: [PATCH] _list_blog: Add check if blog is empty or not. --- qsgen2 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/qsgen2 b/qsgen2 index 7c73990..1289b9c 100755 --- a/qsgen2 +++ b/qsgen2 @@ -169,9 +169,16 @@ export blogdate=$( date +%a-%Y-%b-%d ) # Let's create arrays of all the files we'll be working on function _list_blog() { - ls -1btar blog/*.blog | while read -r file; do - blogs_file_array+=($file) - done + # Check if there are any .blog files in the blog directory + local blog_files=(blog/*.blog) + if [[ ! -f ${blog_files[1]} ]]; then + if (${debug}); then _msg debug "_blog_cache: No blog files found."; fi + return + else + ls -1btar blog/*.blog | while read -r file; do + blogs_file_array+=($file) + done + fi } # BLOG CACHE