| 1 | #! /bin/sh |
| 2 | |
| 3 | # Script to determine whether the first file is newer than the second. |
| 4 | # If the first does not exist, the answer is "no"; |
| 5 | # if the second does not exist, the answer is "yes"; |
| 6 | # otherwise their ages are compared using "find". |
| 7 | |
| 8 | # Copyright (c) The Exim Maintainters 2022 |
| 9 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 10 | |
| 11 | if [ $# -ne 2 ]; then |
| 12 | echo "*** Two file names needed for 'newer' ***" |
| 13 | exit 2; |
| 14 | fi |
| 15 | |
| 16 | if [ ! -f $1 ]; then exit 1; fi |
| 17 | if [ ! -f $2 ]; then exit 0; fi |
| 18 | |
| 19 | case `find $1 -newer $2 -print` in |
| 20 | '') exit 1;; |
| 21 | *) exit 0;; |
| 22 | esac |
| 23 | |
| 24 | # End |