#!/bin/sh # todo: v 1.0 2016/13/10 12:02:00 dcat umask 0177 : ${TODO:=$HOME/TODO} : ${TEMP:=/tmp/todo.tmp} [ $# -eq 0 ] && { nl -n ln <$TODO exit 0 } # portable alternative for `sed` in-place flag in_place() { :>$TEMP || exit 1 sed "$@" <$TODO >$TEMP && mv $TEMP $TODO || rm $TEMP } case "$1" in add) shift echo "$@" >>$TODO ;; rm) shift in_place "$@d" ;; esac