From ab8cc85adde879fb963c94d15675783f2cf4b183 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 14 Aug 2007 05:14:52 +0000 Subject: Initial population. --- config/move-if-change | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 config/move-if-change (limited to 'config/move-if-change') diff --git a/config/move-if-change b/config/move-if-change new file mode 100755 index 00000000..ff74a556 --- /dev/null +++ b/config/move-if-change @@ -0,0 +1,22 @@ +#!/bin/sh +# Like mv $1 $2, but if the files are the same, just delete $1. +# Status is zero if successful, nonzero otherwise. + +usage="$0: usage: $0 SOURCE DEST" + +case $# in +2) ;; +*) echo "$usage" >&2; exit 1;; +esac + +for arg in "$1" "$2"; do + case $arg in + -*) echo "$usage" >&2; exit 1;; + esac +done + +if test -r "$2" && cmp -s "$1" "$2"; then + rm -f "$1" +else + mv -f "$1" "$2" +fi -- cgit v1.2.3