6 ms·
I've been using this zsh function for a year or two: jr () { echo "---" echo "\n##"`date +" %a %D %l:%M%P"` >> ~/journal.txt
by jcw 16y ago
I've been using this zsh function for a year or two:
jr () {
echo "---"
echo "\n##"`date +" %a %D %l:%M%P"` >> ~/journal.txt
cat >> ~/journal.txt
}
It usually emits 72 dashes, so that I can stay within that margin (manually, heh). Edited to not break HN. The '##' is because I habitually markdown format everything.
- Khroma 16y agoThat seems kind of unsafe to me, since it's all keeping it in one file.
- nlco 16y agoHow is it unsafe? (asking because I don't know, not to contradict)
- nitrogen 16y agoOne accidental command and every entry is lost, not just one entry or the most recent. Adding a "git commit journal.txt; git push offsite master" or something similar to your journal script will alleviate that risk. Edit: you also don't have file timestamps to show when an entry was actually written, in case that matters to you.
- billswift 16y agoMine is similar. My journal file is the hidden file ~/.journal and my script is in my home bin directory. It sets up a cat from STDIN, so I can just jot a few things down and ^D. I wanted something that would be as easy to use and non-intrusive as possible. And I used the %% on a line by themselves as the divider, as I also do in my Quotes_Aphorisms file, so scripts for searching and manipulating the fortune databases will also work on them. #!/bin/bash echo "%%" >> ~/.journal date +"%a %Y-%m-%d :: %X" >> ~/.journal cat - >> ~/.journal