Jun 22 2010
A simple lab book
At work I keep all my different tasks in separate screen sessions. Each session has a friendly name which makes sense to me, but also has a variable which captures the bug ID. There are various command line tools I interact with that require the ID so it’s easier if I set it once and don’t need to copy-paste it in each time.
After seeing this post on keeping a “lab book” I realised I could make extra use of this environment variable that I already used.
I save this file in ~/bin/note and I can write quick scribbles to myself in whichever window I’m using and it will go to the correct “book”:
#!/bin/bash LOGDIR=$HOME/labbook if [ "" == "$BUGID" ] then LOGFILE=$LOGDIR/GENERAL.log else LOGFILE=$LOGDIR/$BUGID.log fi if [ "" == "$*" ] then echo "No log written: message empty" else DATE=$( date +%Y%m%d-%H:%M ) mkdir -p $LOGDIR echo $DATE $* >> $LOGFILE fi
It’s not complex but I think it will do wonders for how much I remember to document about my work from day to day.
Update: I learned today the delight of this one-liner which prints everything I’ve done today in order. It’s quite pleasing.
$ grep -h `date +%Y%m%d` labbook/* | sort
Comments Off