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