diff .bash_aliases @ 34:82fde4c9245c

* Date option on Macs is -H, not -h * Make .todo updating non-destructive in case of failure (like excessive calls while testing this script)
author huston@80426f53-59d1-405d-934b-f07cd76f4a1a
date Fri, 05 Mar 2010 19:43:49 +0000
parents f59f847377d7
children a57fad86e03a
line wrap: on
line diff
--- a/.bash_aliases	Fri Mar 05 19:07:47 2010 +0000
+++ b/.bash_aliases	Fri Mar 05 19:43:49 2010 +0000
@@ -21,7 +21,7 @@
     DFSTAT="stat -f %m -t %s $HOME/.dotfilets"
     MDATE="date -v -1m +%s"
     TDSTAT="stat -f %m -t %s $HOME/.todo"
-    HDATE="date -v -1h +%s"
+    HDATE="date -v -1H +%s"
 
     alias ls='ls -FG'
     ;;
@@ -91,11 +91,17 @@
 
   [[ -e $HOME/.todo.$$ ]] && return
 
+  eval $TOODLEDO_CMDS >> $HOME/.todo.$$
+  [[ $? -eq 255 ]] && { 
+    # Update failed; clean up & don't do it again.
+    rm $HOME/.todo.$$
+    touch $HOME/.todo
+    return
+  }
   echo "To-do list as of `date`" > $HOME/.todo
   echo "---------------------------------------------" >> $HOME/.todo
-  eval $TOODLEDO_CMDS | egrep -v ' -- !negative' >> $HOME/.todo.$$
   egrep '^<[0-9]+>' $HOME/.todo.$$ | egrep '#\[[0-9]+/[0-9]+/[0-9]+' | sort -k 4.3 >> $HOME/.todo
-  egrep '^<[0-9]+>' $HOME/.todo.$$ | egrep -v '#\[[0-9]+/[0-9]+/[0-9]+' >> $HOME/.todo
+  egrep '^<[0-9]+>' $HOME/.todo.$$ | egrep -v '(#\[[0-9]+/[0-9]+/[0-9]+|!negative)' >> $HOME/.todo
   rm $HOME/.todo.$$
 }