]> mj.ucw.cz Git - temple.git/blob - example/bin/newer
UCW::Temple: @@ does not creep into if'ed out blocks
[temple.git] / example / bin / newer
1 #!/bin/sh
2 set -e
3
4 #do the files exists?
5 if [ ! -f "$1.new" ]; then exit 0; fi
6
7 #do the original file exists?
8 if [ ! -f "$1" ]
9 then 
10   mv $1.new $1
11   exit 0
12 fi
13
14 #they do, compare them, but ignore the line with 
15 if diff -I "Last modified:.*" $1.new $1 > /dev/null
16 then #they are the same - choose the old one, but set actual timestamp
17   rm -f $1.new
18   touch $1
19 else #they differ
20   mv -f $1.new $1
21 fi