#! /bin/sh -x # # newplan -- Move .plan to backup directory as .plan. Open editor # for new .plan file. __me=`basename $0` PLANDIR=$HOME/public_html/oldplans PLAN=$HOME/.plan umask 002 do_mvplan() { test -x $HOME/bin/mtime || exit 1 test ! -d $PLANDIR && mkdir -p $PLANDIR test -f $PLAN && \ mv $PLAN $PLANDIR/`mtime $PLAN|cut -f2`.txt 2>/dev/null } do_editplan() { exec $EDITOR $PLAN } do_pipeplan() { do_mvplan while read input do [ X$input = "X--" ] && break echo $input >> $PLAN done } do_newplan() { do_mvplan do_editplan } case $__me in newplan|mvplan|editplan|pipeplan) do_$__me;; *) echo "Unrecognized command ($0)" 1>&2; exit 1;; esac exit 0