File: move-if-change

package info (click to toggle)
emacs21 21.4a-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 68,912 kB
  • ctags: 58,887
  • sloc: lisp: 493,229; ansic: 237,171; sh: 28,252; xml: 4,262; makefile: 2,428; perl: 1,069; cs: 776; asm: 254; csh: 9; sed: 4
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