Fun with Bash- Implementing a To-Do List

What? You don’t think it can be done? Explain this, then: desktop, with to-do list</p>

Okay, now that I’ve convinced you, lemme show you, o ye ignorant, how this works: Here’s the script:

#!/bin/bash
handle='~/reminders'

bar='---------------------------------'
# Clear the file
cat /dev/null > $handle
echo "Todo:" >> $handle
echo $bar >> $handle
cat ~/.reminders/work >> $handle

cat ~/.reminders/school >>; $handle
echo "" >> $handle
# Print reminders for the next three days
for i in `seq 0 2`; do
  echo `date -d "today +$i day" "+%A, %B %d, %Y"` >> $handle
  echo $bar >> $handle
  cat ~/.reminders/`date -d "today +$i day" "+%Y%m%d"` >> $handle
  cat ~/.reminders/`date -d "today +$i day" | cut -d" " -f1` >> $handle
  cat ~/.reminders/`date -d "today +$i day" "+%d"` >> $handle
  echo "" >> $handle
done

Copy and paste this bad boy wherever you stick your nice shellscripts. Next, create a directory called .reminders in your home directory. Then, make these files inside of ~/.reminders:

for i in `seq 1 31`; do touch $i; done
touch Mon Tue Wed Thu Fri Sat Sun work school

Now, let’s explain what these files are for. Files 1-31 are used for things that you do on a particular day of the month. Be careful about 31, coz some months don’t have that day(Feb/Apr/Jun/Sept/Nov). Maybe 31 should be a symlink to 30, if you wanna be safe.

Files Mon through Sun are for things that you do on certain days of the week. Files work and school you put tasks you need done for those areas.

Finally, there are another set of files that you have to create yourself. Let’s say I’m a terrible person and I forget my anniversary(7/7/07), so I would create a file called 20080707 for next year, and put the reminder inside. You can use this for duedates, meetings, etc. Pretty nice. Then, you run the shellscript and it writes to a file called ‘reminders’; in your homedir. You can use software such as Conky to display it on your root window in X (mac peeps can figure it out, and windows users: outta luck suckaz :-p) Well, that’s all folks. Hit me up if you like this or if your have ideas to improve my silly method of incorporating bash into my everyday life.