File: newer

package info (click to toggle)
exim4 4.50-8sarge2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 9,852 kB
  • ctags: 5,278
  • sloc: ansic: 75,531; sh: 4,380; makefile: 476; perl: 65
file content (22 lines) | stat: -rwxr-xr-x 541 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/sh
# $Cambridge: exim/exim-src/scripts/newer,v 1.1 2004/10/06 15:07:40 ph10 Exp $

# Script to determine whether the first file is newer than the second.
# If the first does not exist, the answer is "no";
# if the second does not exist, the answer is "yes";
# otherwise their ages are compared using "find".

if [ $# -ne 2 ]; then
  echo "*** Two file names needed for 'newer' ***"
  exit 2;
fi

if [ ! -f $1 ]; then exit 1; fi
if [ ! -f $2 ]; then exit 0; fi

case `find $1 -newer $2 -print` in
'')	exit 1;;
*)	exit 0;;
esac

# End