From 2a00602e91515ed0d409404f23929955ac533ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Wed, 31 Jan 2024 20:59:08 +0100 Subject: [PATCH] Re-add function _list_blog and check if the directory blog is empty or not. --- qsgen2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qsgen2 b/qsgen2 index ce45009..7c73990 100755 --- a/qsgen2 +++ b/qsgen2 @@ -167,9 +167,23 @@ export today=$( date "+%Y-%m-%d - %T" ) 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 +} + # BLOG CACHE function _blog_cache() { local debug=false + + # 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 + fi # Create an associative array for the blog cache typeset -A blog_cache