Sync toplevel and config/ from GCC.
[deliverable/binutils-gdb.git] / move-if-change
CommitLineData
252b5132 1#!/bin/sh
2016dfcc
BE
2# Like mv $1 $2, but if the files are the same, just delete $1.
3# Status is zero if successful, nonzero otherwise.
252b5132 4
2016dfcc 5usage="$0: usage: $0 SOURCE DEST"
252b5132 6
2016dfcc
BE
7case $# in
82) ;;
9*) echo "$usage" >&2; exit 1;;
10esac
11
12for arg in "$1" "$2"; do
13 case $arg in
14 -*) echo "$usage" >&2; exit 1;;
15 esac
16done
17
18if test -r "$2" && cmp -s "$1" "$2"; then
19 rm -f "$1"
252b5132 20else
2016dfcc 21 mv -f "$1" "$2"
252b5132 22fi
This page took 0.478651 seconds and 4 git commands to generate.