| 1 | #! /bin/sh |
| 2 | # $Cambridge: exim/src/scripts/newer,v 1.1 2004/10/06 15:07:40 ph10 Exp $ |
| 3 | |
| 4 | # Script to determine whether the first file is newer than the second. |
| 5 | # If the first does not exist, the answer is "no"; |
| 6 | # if the second does not exist, the answer is "yes"; |
| 7 | # otherwise their ages are compared using "find". |
| 8 | |
| 9 | if [ $# -ne 2 ]; then |
| 10 | echo "*** Two file names needed for 'newer' ***" |
| 11 | exit 2; |
| 12 | fi |
| 13 | |
| 14 | if [ ! -f $1 ]; then exit 1; fi |
| 15 | if [ ! -f $2 ]; then exit 0; fi |
| 16 | |
| 17 | case `find $1 -newer $2 -print` in |
| 18 | '') exit 1;; |
| 19 | *) exit 0;; |
| 20 | esac |
| 21 | |
| 22 | # End |