commit be8b1d3e6b5a041fa8121af829a2329699f33487 Author: sigil-03 Date: Wed May 14 21:28:28 2025 -0600 add journaling function diff --git a/README.md b/README.md new file mode 100644 index 0000000..20cd5ed --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# NOTE +functions that i use for taking notes + + +## `journal()` +use to enter a timestamped text entry to a file with the current date. will create the file if it does not exist. diff --git a/journal.shf b/journal.shf new file mode 100644 index 0000000..df6c089 --- /dev/null +++ b/journal.shf @@ -0,0 +1,17 @@ +# ENV REQUIREMENTS: +# - JOURNALDIR: default journal directory + +function journal() { + if [ ! -d "${JOURNALDIR}" ]; then + mkdir -p "${JOURNALDIR}" + fi + FILE="${JOURNALDIR}$(date '+%Y-%m-%d')" + echo "${FILE}" + if [ ! -f $FILE ]; then + echo "$(date '+%Y-%m-%d')\n" >> $FILE + else + echo "\n" >> $FILE + fi + echo ">> $(date '+%H:%M:%S')" >> $FILE + vim +$ ${FILE} +}