File:  [GCC 2.x] / gcc / move-if-change
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 18:06:37 2018 UTC (8 years, 2 months ago) by root
Branches: fsf, MAIN
CVS tags: gcc-2723, gcc-2722, gcc-2721, gcc-272, gcc-263, gcc-258, gcc-245, HEAD
gcc-2.4.5

#!/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 -s $1 $2
then
echo $2 is unchanged
rm -f $1
else
mv -f $1 $2
fi
else
mv -f $1 $2
fi

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.