Bare-bones time tracker

Lifehacker is always suggesting super-complicated GUI applications for keeping track of one’s billing hours or making todo lists. Here’s my 10-minute solution that I’ve been using for a while — ~/bin/wl:

#! /bin/bash
if [[ -z $1 ]]; then
    cat ~/docs/worklog.`date +%Y-%m`
else
    (d=`date +"%Y-%m-%d %H:%M:%S"`; echo "$d" $@)>> ~/docs/worklog.`date +%Y-%m`
fi

I use it like this:

$ wl something goes here
$ wl tkt 192323 - remove n**2 loop from the frobnicator
$ wl
2011-11-04 09:55:56 something goes here
2011-11-04 09:56:07 tkt 192323 - remove n**2 loop from the frobnicator

I also sometimes start a log message with a single upper-case or symbol character to indicate something else; e.g., “^” means start of a block of time, “$” means end, “T” means todo, etc. It isn’t perfect — sometimes you have to escape shell meta-characters, but it beats using a mouse, and the backing format is plain old text so grep/vi/etc still work.