Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I just wrote myself a little script. Let's see, if it sticks ...

  $ cat bin/journal 
  #!/bin/bash
  FILE=${HOME}/Dropbox/journal.txt
  echo >>${FILE}
  date >>${FILE}
  echo >>${FILE}
  vim + ${FILE}


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.


Mine 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


That seems kind of unsafe to me, since it's all keeping it in one file.


How is it unsafe? (asking because I don't know, not to contradict)


One 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.


I'm doing something similar. I found a cool vim command, ':r !date' for the current date. I'm using hg mercurial in addition to get additional backup security and logging. : P

I also decided host the repo at bitbucket. This will let me have 'offsite' backups and the ability to pull my journal whenever I have a computer and internet... which is always.


"Pro-tip": you can also do :.!date


I wrote something similar just the other day :)

I don't write daily though, only when I feel like it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: