how to compare file modification time (whole dir tree?)

Fritz Nordby fritz at mercury.caltech.edu
Fri Aug 3 05:50:56 AEST 1990


Am I missing something here, or will the
following provide the desired function:

#!/bin/sh
case $# in 2);;*)echo "usage: ${0:-newer} file1 file2" >&2;exit 2;;esac
[ ! -f "$2" -o -f "$1" -a "X`/bin/ls -t \"\$1\" \"\$2\"`" = "X$1
$2"] >/dev/null 2>&1


I suppose this will fail if, for example, it is invoked as
$ newer 'foo
foo' 'foo'
but people who put newlines in their filenames get what they deserve!



More information about the Alt.sources mailing list