source: branches/replacing_gnuplot/build_support/move-if-change @ 646

Last change on this file since 646 was 646, checked in by Jari Häkkinen, 15 years ago

Merged trunk changes r608:645 to replacing_gnuplot branch.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 384 bytes
Line 
1#!/bin/sh
2# Like mv $1 $2, but if the files are the same, just delete $1.
3# Status is zero if successful, nonzero otherwise.
4
5usage="$0: usage: $0 SOURCE DEST"
6
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"
20else
21  mv -f "$1" "$2"
22fi
Note: See TracBrowser for help on using the repository browser.