_list_blog: Rewrite

This commit is contained in:
Stig-Ørjan Smelror 2024-01-31 21:04:19 +01:00
parent 3df24ddaad
commit 132f649d93

12
qsgen2
View File

@ -169,14 +169,16 @@ export blogdate=$( date +%a-%Y-%b-%d )
# Let's create arrays of all the files we'll be working on # Let's create arrays of all the files we'll be working on
function _list_blog() { function _list_blog() {
# Check if there are any .blog files in the blog directory local debug=false
local blog_files=(blog/*.blog) local blog_files=(blog/*.blog)
if [[ ! -f ${blog_files[1]} ]]; then
if (${debug}); then _msg debug "_blog_cache: No blog files found."; fi # Check if array is empty
if (( ${#blog_files[@]} == 0 || ! -f ${blog_files[1]} )); then
if (${debug}); then _msg debug "_list_blog: No blog files found."; fi
return return
else else
ls -1btar blog/*.blog | while read -r file; do for file in blog/*.blog; do
blogs_file_array+=($file) blogs_file_array+=("$file")
done done
fi fi
} }