Comparing modified times of files

Randal L. Schwartz merlyn at iwarp.intel.com
Thu Mar 14 02:49:53 AEST 1991


In article <1991Mar11.183338.9082 at mrspoc.Transact.COM>, itkin at mrspoc (Steven M. List) writes:
| If you're interested in something a bit faster that can also handle a
| LIST of files, I wrote a little program a few years back that does
| a few things:
| 
|     -   compares the last modification times of the files on the command
|         line
|     -   exits with the ordinal of the newest file as the status code
|     -   prints the name of the newest file on standard output
| 
| So, just on the off-chance that someone can use it, here it is:
| -----------CUT HERE-----------------------------------------------------------
[C code deleted]

For comparison, a similar routine in Perl:

perl -e '$n = shift; $m = -M $n; for (@ARGV) {$n = $_ if -M $_ < $m;} print $n'

Just another Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/



More information about the Comp.unix.shell mailing list