zia

...now on my laptop...

Friday, 2002-12-13

ziaposts shell script

Now here's a silly thing. I made a shell (zsh) script that echoes the local filenames of my bzero weblog's last-dated postings. Default is just the last one; you can also ask for the day or the month. It back-substitutes "~" for your home directory unless you give it a "-/" argument. It probably won't work on non-Unix systems, though I suppose a cygwin port wouldn't be too difficult.

Common usage?
  • grep something `ziaposts -/ month` — see where you posted about something
  • vi `ziaposts -/` — re-edit your last posting
  • rm `ziaposts -/` — remove your last posting
  • for ff in `ziaposts -/ all` ; do something ; done — revise all of history

Much of the extra mechanism is to make sure that the posts are in chronological "post-date" order. Less mechanism ("find foo -print") would be needed if bzero would retain one leading zero on filenames corresponding to months before October and days before the 10th.

Here's the script: http://www.pycs.net/zia/2002/12/13/ziaposts but you'll have to edit it to change the weblog name to be your own, or parameterize that if you have more than one bzero weblog.

Comment on this post [ so far]