view move-if-change @ 2385:6b957313bd8e

[xemacs-hg @ 2004-11-13 06:32:24 by ben] fix for Marcus's crash text.c: Two different occurrences of a string stringized from the exact same parameter may not necessarily be the same string, so check with strcmp.
author ben
date Sat, 13 Nov 2004 06:32:25 +0000
parents 376386a54a3c
children
line wrap: on
line source

#!/bin/sh
if
test -r $2
then
if
cmp $1 $2 > /dev/null
then
echo $2 is unchanged
rm -f $1
else
mv -f $1 $2
fi
else
mv -f $1 $2
fi