My TODO List

Instead of using a notebook (or three crumpled receipts), I’ve moved to a TODO setup that lives in my shell config file.


  1. Paste the following block in your shell config file:
# TODO SCRIPT. use as move_todo line_number
move_todo() {
    local linenum=$1
    local date_today=$(date +"%d/%m")
    local time_now=$(date +"%H%M")

    # Add date header if not already present
    if ! grep -q "^$date_today" done; then
        echo "$date_today" >> done
    fi

    # Move line with timestamp and checkbox
    sed -n "${linenum}p" todo \
        | sed "s/^\[\]/[X] ${time_now}:/" >> done

    # Delete the original line from todo
    sed -i '' "${linenum}d" todo
}
  1. Make a todo file and a done file.

  2. Add an item to your todo list. Some examples:

[] post TODO script
[] drink coffee
  1. To move an item to the done list:
move_todo 1
  1. The done file is now updated:
[X] 0756: post TODO script
  1. Make sure to change into the directory where your done and todo files live before using move_todo.