From 4ba19ab5692fa99d6d4130d60f319f150c523fd4 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 21 Jun 2025 13:03:04 +0200 Subject: [PATCH] feat: script for creating a new journal entry --- new_journal.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 new_journal.sh diff --git a/new_journal.sh b/new_journal.sh new file mode 100755 index 0000000..d7b62df --- /dev/null +++ b/new_journal.sh @@ -0,0 +1,24 @@ +#! /usr/bin/bash + +echo "NEW NOTE" + +journal_dir="/home/ayo/notes/Journal" + +date_today=$(date +'%m-%d-%Y') +date_today_file_name=$(date +'%m.%d.%Y') +month_dir=$(date +"%m %b") +file_name="${date_today_file_name}.md" +full_path="${journal_dir}/${month_dir}/${file_name}" + +# IF Not Exists: create file & echo date +if ! test -f "$full_path"; then + install -Dv /dev/null $full_path + echo writing $date_today to "$full_path" + echo $date_today > "$full_path" +fi + +vim "$full_path" + + +# report, write log +echo ">>> " $month_dir / $file_name