Skip to content

Instantly share code, notes, and snippets.

@trengrj
Last active May 28, 2017 17:00
Show Gist options
  • Save trengrj/2850682f06574a10add2 to your computer and use it in GitHub Desktop.
Save trengrj/2850682f06574a10add2 to your computer and use it in GitHub Desktop.
todo application using ed
#!/bin/bash
TODOFILE=~/.plan
case "$1" in
add)
printf '%s\n' a "$2 []" . w | ed -s $TODOFILE
;;
delete)
printf '%s\n' "$2d" w | ed -s $TODOFILE
;;
complete)
printf '%s\n' "$2s/\\[\\]/[x]/" w | ed -s $TODOFILE
;;
*)
cat -n $TODOFILE
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment