1*7f2fe78bSCy Schubert#!/bin/sh 2*7f2fe78bSCy Schubert# Move file 1 to file 2 if they don't already match. 3*7f2fe78bSCy Schubert# Good for "make depend" for example, where it'd be nice to keep the 4*7f2fe78bSCy Schubert# old datestamp. 5*7f2fe78bSCy Schubertif [ $# != 2 ]; then 6*7f2fe78bSCy Schubert echo 2>&1 usage: $0 newfile oldfilename 7*7f2fe78bSCy Schubert exit 1 8*7f2fe78bSCy Schubertfi 9*7f2fe78bSCy Schubert# 10*7f2fe78bSCy Schubertif [ ! -r "$2" ]; then 11*7f2fe78bSCy Schubert exec mv -f "$1" "$2" 12*7f2fe78bSCy Schubertfi 13*7f2fe78bSCy Schubertif cmp "$1" "$2" >/dev/null; then 14*7f2fe78bSCy Schubert echo "$2 is unchanged" 15*7f2fe78bSCy Schubert exec rm -f "$1" 16*7f2fe78bSCy Schubertfi 17*7f2fe78bSCy Schubertexec mv -f "$1" "$2" 18