aboutsummaryrefslogtreecommitdiffstats
path: root/_tj
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2022-01-05 09:03:56 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2022-01-05 09:03:56 +0000
commit5134ccce935a68b52eceb106e244c4ef53b64151 (patch)
treed411a0cfde77b4d66e216aaae23fdb7a65f9d027 /_tj
parentf766bd8ad8c46e9a7b9010fe9681ff8db5a96add (diff)
added new script to for journalling
Diffstat (limited to '_tj')
-rwxr-xr-x_tj25
1 files changed, 25 insertions, 0 deletions
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
+
+