What Planet is This?

08 Jul 2005

Weblog of Editing

One problem with blosxom is that if you modify a post, it jumps forwards to the new modification time in the feeds and on the homepage. If you're just correcting a typo rather than making a substantive change, this is not cool. Moreover, even if you are making a big change it would be nice to preserve the original publication time of the post to some extent.

I remembered though that Simon Cozens wrote a neat little script called tardis in his secret software page, and it appears that he wrote it for blosxom too. His version just seems to be a friendlier version of touch, so is only for use in a larger piece of code.

So I worked on a script that edits an entry and then changes its mtime back to one second after the original time. That way, the original time is more or less preserved, but all of the entry times in the feed will be updated (I've actually been using this approach for a while on miscoranda). It's just a two line piece of bash:

#!/bin/bash
STAMP=$(date -d @$(($(stat -c %Y $1) + 1)) +%Y%m%d%H%M.%S) 
nano $1 && touch -t $STAMP $1

Though it requires some of that stuff about date which isn't in the man page entry, but is in the gnu.org documentation.

I've called the script creep, since it creeps the mtime of the file onwards just a little. Sidenote: cygwin seems to not update its PATH completion database in real time, so when you link a new script in /usr/local/bin you can't tab-complete the name at first. To solve that, I tend to do which scriptname, and that sorts it out.

Cite: Palmer, S.B. (2005). "Weblog of Editing", in: What Planet is This?
Archival URI: http://inamidst.com/notes/editing

Feedback?

Your email address:
(Feedback is moderated. Relevant feedback will be displayed below. The email addresses of senders are not revealed.)

About

Periodical essays on linguistics, history, and much more, from Shakespeare to post Romano-​British findings. Like Notes and Queries sans the queries and solely antiquarian disposition.

Subscribe Online

Appurtenances

There is a list of essays. For queries, email the author.

Apparatus

Powered by Azimuth

XHTML 1.0 inamidst.com