Shell Script for Remember the Milk

Saturday April 17, 2010

•  geekery •  GTD •  Remember the Milk • 

A couple of weeks ago, the Remember the Milk blog posted about adding tasks at the command line. A simple way to handle task generation, but a bit too complex for even your average Unix hacker. This script makes it easy and gives you an option to add a note! Just set RTMADDR and PROG to be your Remember the Milk email address and your local script name, i.o.:

#!/bin/sh

RTMADDR='user+NNN@rmilk.com'
PROG='rtm'

TEMP=`getopt -o n --long note -n $PROG -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
while true; do
        case "$1" in
                -n|--note) NOTE='true'; shift;;
                --) shift ; break ;;
                *) help;
        esac
done

if [ x$NOTE == 'x' ]; then
    mailx -s "$1" $RTMADDR < /dev/null > /dev/null
else
    mailx -s "$1" $RTMADDR
fi

From RTM’s example,

rtm "Test code changes committed by Bart. ^tom @ 9a !1 #Testing #na @Work"

And use -n if you’d like it to ask for a note.