From 5134ccce935a68b52eceb106e244c4ef53b64151 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 5 Jan 2022 09:03:56 +0000 Subject: added new script to for journalling --- _tj | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 _tj (limited to '_tj') diff --git a/_tj b/_tj new file mode 100755 index 0000000..469c4cb --- /dev/null +++ b/_tj @@ -0,0 +1,25 @@ +#!/bin/bash + +# Our target file +TODAY_JOURNAL=~/Notes/journal/$(date +\%Y-\%m-\%d).md + +# Test whether it already exisits or not +if [[ -a $TODAY_JOURNAL ]] +then + while read line + do + JLINE="- $(date +'%H:%M'): $line" + echo $JLINE >> "$TODAY_JOURNAL" + done < "${1:-/dev/stdin}" +else + touch $TODAY_JOURNAL + header_date="$(date +'%A %d %b %Y')" + echo -e "# $header_date\n" >> $TODAY_JOURNAL + while read line + do + JLINE="- $(date +'%H:%M'): $line" + echo $JLINE >> "$TODAY_JOURNAL" + done < "${1:-/dev/stdin}" +fi + + -- cgit v1.2.3