| Revision: | 1.1 |
| Committed: | Thu Jun 30 14:26:41 2005 UTC (21 years, 3 months ago) by root |
| Branch: | MAIN |
| CVS Tags: | PERL-5-8-7, HEAD |
| Branch point for: | PERL |
| Log Message: | *** empty log message *** |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | root | 1.1 | : mv-if-diff file1 file2 |
| 2 | : move file1 to file2 if file1 and file2 are different. | ||
| 3 | |||
| 4 | if test $# -lt 2 ; then | ||
| 5 | echo "usage: $0 file1 file2" | ||
| 6 | echo "move file1 to file2 if file1 and file2 are different." | ||
| 7 | exit 1 | ||
| 8 | fi | ||
| 9 | if cmp $1 $2 >/dev/null 2>&1; then | ||
| 10 | echo "File $2 not changed." | ||
| 11 | rm -f $1 | ||
| 12 | else | ||
| 13 | rm -f $2 | ||
| 14 | mv $1 $2 | ||
| 15 | fi |