A very simple implementation of a Tickler system in bash

|

One really nice aspect of Getting Things Done is the Tickler system: have 43 folders, 31 for the days, 12 for the months. Every morning, empty the corresponding folder and deal with it. Do the same with the current month folder if it's the first of the month.

Now when something needs to get done later (for instance to remember to make a restaurant reservation in a few days), you just put it in the corresponding folder and forget about it.

This works great for paper based folders, but I also wanted some similar system for my digital data. Putting things in a calendar isn't very nice, because it's visible and when I look at a monthly view it's already there to bug me. So I wanted a system that:

  • puts things out of sight;
  • automatically reminds me of them when the time is right;
  • is easy to add things to.

There is a great Unix program called Remind which could probably do what I want. But I don't know it yet, and I wanted to hack something together fast, then maybe learn about Remind later. Here is the result of half an hour of hacking.

I first created a folder, Tickler, containing 31 text files (01.txt to 31.txt) and 12 text files (January.txt to December.txt). There is also a backup.txt where all the content that is removed from the other files is going to go (just in case). And I wrote the following script:

#!/bin/sh

ticklerdir=/Users/schmitta/Documents/Tickler
ticklerbak=$ticklerdir/backup.txt

day=`date "+%d"`
month=`date "+%B"`

echo Tickler for `date "+%F"`
echo

if [[ $day == 01 ]]; then
    mfile=$ticklerdir/$month.txt
    if [[ ! -f $mfile ]]; then
        echo "File $mfile does not exist!!!";
        exit 1;
    fi
    if [[ -s $mfile ]]; then
        echo `date` $month >> $ticklerbak
        cat $mfile >> $ticklerbak
        echo "Monthly tickler for $month"
        echo
        cat $mfile
        echo
        echo
        echo -n "" > $mfile
    else
        echo "No monthly tickler"
    fi
fi
file=$ticklerdir/$day.txt
if [[ ! -f $file ]]; then
    echo "File $file does not exist!!!";
    exit 1;
fi
if [[ -s $file ]]; then
    echo `date` $day >> $ticklerbak
    cat $file >> $ticklerbak
    echo "Daily tickler for $month $day"
    echo
    cat $file
    echo -n "" > $file
else
    echo "No daily tickler"
fi

What this does is fairly simple: it it's the first of the month and the current month file is not empty, it backs it up, outputs it, and empties it. Then if the current day file is not empty, it does the same. As this in run as a cron job, the results are emailed to me, every early morning. Email is a very nice place to get this information as it's one of the first things I check every morning. So this clearly fulfills the first two requirements.

Concerning the third requirement, I simply use Quicksilver to append text to the files. And I can always edit them in Vim. And if something breaks, the files are still synchronized locally, so I have access to them.

Sometimes plain text is just the way to go...

About this Entry

This page contains a single entry by Alan Schmitt published on July 3, 2006 7:08 PM.

Mail is not such a nice storage system finally... was the previous entry in this blog.

Updated to RW 3.5 beta 3 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Recently Played Games