aboutsummaryrefslogtreecommitdiff
path: root/pages/home.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pages/home.sh')
-rwxr-xr-xpages/home.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/pages/home.sh b/pages/home.sh
index c9a9966..02adf53 100755
--- a/pages/home.sh
+++ b/pages/home.sh
@@ -13,8 +13,19 @@ WELCOME
print-all-articles () {
# Find all articles and sort by date of creation
- for i in $(find $ARTICLES_PATH -type f -name '*.txt' -printf "%T@ %p\n" | sort -rn | cut -b 23-); do
- ARTICLE_FILE="${i/* /}" source $SCRIPT_DIR/components/post-preview.sh
+ IFS=';' read -ra ARTICLE_LIST <<< "$(
+ find $ARTICLES_PATH \
+ -type f \
+ -name '*.txt' \
+ -printf "%T@ %p\n" |
+ sort -rn |
+ cut -b 23- |
+ sed 's/^ //g' |
+ tr '\n' ';'
+ )"
+
+ for i in "${ARTICLE_LIST[@]}"; do
+ ARTICLE_FILE="$i" source $SCRIPT_DIR/components/post-preview.sh
done
}