From 4c57f9814678006558487b7bd47f1f9b69e025e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Mon, 12 Feb 2024 22:24:13 +0100 Subject: [PATCH] Refactor _blog_index function in qsgen2 script This commit refactors the _blog_index function in the qsgen2 script. The changes include: - Commenting out the debug messages for the content of blog_index_content. - Using the `tee` command with the `-overwrite` option to write the blog_index_content to ${www_root}/blog/index.html. - Redirecting the output of `tee` to /dev/null to suppress any output. --- qsgen2 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/qsgen2 b/qsgen2 index c9da440..f8a1429 100755 --- a/qsgen2 +++ b/qsgen2 @@ -917,13 +917,10 @@ function _blog_index() { if (${debug}); then _msg debug "_blog_index: Writing ${www_root}/blog/index.html" _msg debug "_blog_index: Content length of blog_index_content: ${#blog_index_content}" - _msg debug "_blog_index: Content of blog_index_content" - _msg sub "${blog_index_content}" + #_msg debug "_blog_index: Content of blog_index_content" + #_msg sub "${blog_index_content}" fi - printf "%s" "$blog_index_content" > ${www_root}/blog/index.html || { - echo "Failed to write to ${www_root}/blog/index.html" - exit 1 - } + echo "$blog_index_content" | tee -overwrite ${www_root}/blog/index.html > /dev/null _f_last_updated ${www_root}/blog/index.html fi