feat: script for creating a new journal entry
This commit is contained in:
parent
48c191cb24
commit
4ba19ab569
1 changed files with 24 additions and 0 deletions
24
new_journal.sh
Executable file
24
new_journal.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue