Sigh - today's not my day for writing shell script.  Actually do the right thing now.