file times and shell commands

std-unix at ut-sally.UUCP std-unix at ut-sally.UUCP
Fri Dec 5 01:18:16 AEST 1986


From: glc at akgua.UUCP (glc)
Date: 30 Nov 86 16:02:09 GMT
Organization: AT&T Technologies/Bell Labs, Atlanta

> > There doesn't appear to be any decent way to compare the last modified
> > times of files from the shell...
> 
> Before everybody starts inventing their own names for this, it should be
> noted that V8 already has a program for this, newer(1).  
 
The newer(1) program is a very good solution to the problem.  For
those who (for whatever reason) do not wish to implement it, there
is an alternate method using the "make" command.

Make(1) has the "-q" option which causes it to return zero or
non-zero after checking the dependencies.  Here is an example:

  if echo "$DEPENDENT:$CONTROL;:" | make -f - -q
    then # The dependent file is up-to-date
    else # The control file is newer that the dependent file
  fi

Cheers,
  Lindsay

Lindsay Cleveland  (akgua!glc) (404) 447-3909   Cornet 583-3909
AT&T Technologies/Bell Laboratories ... Atlanta, Ga



Volume-Number: Volume 8, Number 61



More information about the Mod.std.unix mailing list