From 5fc653e694d1f8e4531e7b9283935c0d338af9de Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 21 Jun 2025 13:04:07 +0200 Subject: [PATCH] refactor: format and comment --- new_note.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 new_note.sh diff --git a/new_note.sh b/new_note.sh new file mode 100644 index 0000000..16a8ea8 --- /dev/null +++ b/new_note.sh @@ -0,0 +1,21 @@ +#! /usr/bin/bash + +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 $date_today > "$full_path" +fi + +# Open entry in editor +vim "$full_path" + +# Report, TODO: write log +echo ">>> " $month_dir / $file_name