--- gcc/move-if-change 2018/04/24 17:51:20 1.1.1.1 +++ gcc/move-if-change 2018/04/24 18:06:37 1.1.1.3 @@ -1,9 +1,11 @@ #!/bin/sh +# Like mv $1 $2, but if the files are the same, just delete $1. +# Status is 0 if $2 is changed, 1 otherwise. if test -r $2 then if -cmp $1 $2 > /dev/null +cmp -s $1 $2 then echo $2 is unchanged rm -f $1