Sign in
third-party-mirror
/
R
/
7a8070cb389d53475afe0cf97ba6c2280b111c32
/
.
/
tools
/
move-if-change
blob: 24333465f58d40c061492d64941882d2e0b0cc27 [
file
] [
log
] [
blame
]
# Like mv $1 $2, but if the files are the same, just delete $1.
# Status is 0 if $2 is changed, 1 otherwise.
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