view move-if-change @ 3504:3151d67d15d2

[xemacs-hg @ 2006-07-11 23:40:15 by james] Fix a dangerous strcpy by ensuring that the target string is exactly big enough to hold the data. <m3irm9ywg0.fsf@jerrypc.cs.usu.edu>
author james
date Tue, 11 Jul 2006 23:40:17 +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