Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.unix.shell Subject: Re: Comparing modified times of files Message-ID: <1991Mar13.164953.12877@iwarp.intel.com> Date: 13 Mar 91 16:49:53 GMT References: <1991Mar11.183338.9082@mrspoc.Transact.COM> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Followup-To: comp.unix.shell Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 24 In-Reply-To: itkin@mrspoc.Transact.COM (Steven M. List) In article <1991Mar11.183338.9082@mrspoc.Transact.COM>, itkin@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@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/