[Sussex] workaround script

John Crowhurst fyremoon at fyremoon.net
Sun Oct 3 21:27:56 UTC 2004


Hello,

I'm very forgetful these days, especially when I'm working with code.
Developing a perl script its too easy to make some terrible change, exit
the editor and find the backup doesn't possess the bit you've changed.

After a number of mistakes I wrote this wrapper for the editor joe (you
can probably use any editor, but joe does bizarre things with multiple
files):

#!/bin/tcsh
foreach x ($argv)
rm -f /tmp/$x
cp -f $x /tmp/$x
/usr/bin/joe $x
diff -u /tmp/$x $x >/tmp/changes
mail -s "joe: $PWD/$x changes" $USER </tmp/changes
rm -f /tmp/$x

Its horrible, especially as I couldn't work out how to get joe to work in
perl, or I would have built in traps for empty strings and fixed the
backup file so that it works with other paths.

For instance, joe filename works, but joe path/to/filename doesn't.

--
John




More information about the Sussex mailing list