[Sussex] workaround script
Thomas Adam
thomas at edulinux.homeunix.org
Sun Oct 3 21:51:20 UTC 2004
On Sun, Oct 03, 2004 at 10:40:42PM +0100, John Crowhurst wrote:
> joe does, but the script falls over terribly, as it tries to create a file
> /tmp/path/to/filename.
Let me re-write your script in bash:
#!/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
--------
#!/bin/sh
for i in "$@"; do
a=$(basename $i)
[ -f "/tmp/$a" ] && rm -f /tmp/$a
cp "$i" /tmp/$a
joe /tmp/$a
diff -u /tmp/$a $a > /tmp/changes
mail -s "joe: $PWD/$x changes" $USER </tmp/changes
rm /tmp/$a
done
----------
I haven't tested it, so I have no idea if it is accurate or does what the
original does. It's called by:
./filename file file2 file3
-- Thomas Adam
--
$ source ~/.bash_history
More information about the Sussex
mailing list