Last change
on this file since 937 was
845,
checked in by Jari Häkkinen, 13 years ago
|
Merged trunk changes -r782:844 to replacing_gnuplot branch.
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
File size:
513 bytes
|
Rev | Line | |
---|
[569] | 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 | |
---|
[845] | 5 | usage="$0: usage: $0 [-v] SOURCE DEST" |
---|
[569] | 6 | |
---|
[845] | 7 | if test "x$1" = "x-v"; then |
---|
| 8 | verbose=yes |
---|
| 9 | shift |
---|
| 10 | fi |
---|
| 11 | |
---|
[569] | 12 | case $# in |
---|
| 13 | 2) ;; |
---|
| 14 | *) echo "$usage" >&2; exit 1;; |
---|
| 15 | esac |
---|
| 16 | |
---|
| 17 | for arg in "$1" "$2"; do |
---|
| 18 | case $arg in |
---|
| 19 | -*) echo "$usage" >&2; exit 1;; |
---|
| 20 | esac |
---|
| 21 | done |
---|
| 22 | |
---|
| 23 | if test -r "$2" && cmp -s "$1" "$2"; then |
---|
| 24 | rm -f "$1" |
---|
| 25 | else |
---|
[845] | 26 | if test "x$verbose" = "xyes"; then |
---|
| 27 | echo "updating file $2" |
---|
| 28 | fi |
---|
[569] | 29 | mv -f "$1" "$2" |
---|
| 30 | fi |
---|
Note: See
TracBrowser
for help on using the repository browser.