GCC with OpenMP stream-computing extension and BatchQueue algorithm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

move-if-change 384B

12345678910111213141516171819202122
  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. usage="$0: usage: $0 SOURCE DEST"
  5. case $# in
  6. 2) ;;
  7. *) echo "$usage" >&2; exit 1;;
  8. esac
  9. for arg in "$1" "$2"; do
  10. case $arg in
  11. -*) echo "$usage" >&2; exit 1;;
  12. esac
  13. done
  14. if test -r "$2" && cmp -s "$1" "$2"; then
  15. rm -f "$1"
  16. else
  17. mv -f "$1" "$2"
  18. fi