repo.or.cz
/
glibc
/
history.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Tue Jul 16 16:43:58 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc/history.git]
/
move-if-change
blob
66d8b8adc7fbcada50bc93f3b1f0390c39d73135
1
#!/bin/sh
2
# Like mv $1 $2, but if the files are the same, just delete $1.
3
# Status is 0 if $2 is changed, 1 otherwise.
4
if
5
test -r
$2
6
then
7
if
8
cmp
-s
$1 $2
9
then
10
echo
$2
is unchanged
11
rm
-f
$1
12
else
13
mv
-f
$1 $2
14
fi
15
else
16
mv
-f
$1 $2
17
fi