File: move-if-change

package info (click to toggle)
libgmp2 2.0.2-10
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,904 kB
  • ctags: 1,916
  • sloc: ansic: 18,659; asm: 8,720; sh: 1,760; makefile: 829
file content (15 lines) | stat: -rwxr-xr-x 129 bytes parent folder | download | duplicates (74)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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