123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #!/bin/sh
- VERSION='2011-01-28 20:09';
- usage="usage: $0 SOURCE DEST"
- help="$usage
- or: $0 OPTION
- If SOURCE is different than DEST, then move it to DEST; else remove SOURCE.
- --help display this help and exit
- --version output version information and exit
- The variable CMPPROG can be used to specify an alternative to \`cmp'.
- Report bugs to <bug-gnulib@gnu.org>."
- version=`expr "$VERSION" : '\([^ ]*\)'`
- version="move-if-change (gnulib) $version
- Copyright (C) 2011 Free Software Foundation, Inc.
- License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law."
- cmpprog=${CMPPROG-cmp}
- for arg
- do
- case $arg in
- --help | --hel | --he | --h)
- exec echo "$help" ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v)
- exec echo "$version" ;;
- --)
- shift
- break ;;
- -*)
- echo "$0: invalid option: $arg" >&2
- exit 1 ;;
- *)
- break ;;
- esac
- done
- test $# -eq 2 || { echo "$0: $usage" >&2; exit 1; }
- if test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null; then
- rm -f -- "$1"
- else
- if mv -f -- "$1" "$2"; then :; else
-
- test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null && rm -f -- "$1"
- fi
- fi
|