add journaling function
This commit is contained in:
commit
be8b1d3e6b
2 changed files with 23 additions and 0 deletions
6
README.md
Normal file
6
README.md
Normal file
|
|
@ -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.
|
||||||
17
journal.shf
Normal file
17
journal.shf
Normal file
|
|
@ -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}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue