1321fbaf8Sespie#!/bin/sh 2*20fce977Smiod# Like mv $1 $2, but if the files are the same, just delete $1. 3*20fce977Smiod# Status is zero if successful, nonzero otherwise. 4321fbaf8Sespie 5*20fce977Smiodusage="$0: usage: $0 SOURCE DEST" 6321fbaf8Sespie 7*20fce977Smiodcase $# in 8*20fce977Smiod2) ;; 9*20fce977Smiod*) echo "$usage" >&2; exit 1;; 10*20fce977Smiodesac 11*20fce977Smiod 12*20fce977Smiodfor arg in "$1" "$2"; do 13*20fce977Smiod case $arg in 14*20fce977Smiod -*) echo "$usage" >&2; exit 1;; 15*20fce977Smiod esac 16*20fce977Smioddone 17*20fce977Smiod 18*20fce977Smiodif test -r "$2" && cmp -s "$1" "$2"; then 19*20fce977Smiod rm -f "$1" 20321fbaf8Sespieelse 21*20fce977Smiod mv -f "$1" "$2" 22321fbaf8Sespiefi 23