home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1637 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  655 b 

  1. From: fritz@mercury.caltech.edu (Fritz Nordby)
  2. Newsgroups: comp.unix.questions,alt.sources
  3. Subject: Re: how to compare file modification time  (whole dir tree?)
  4. Message-ID: <1990Aug2.195056.4041@laguna.ccsf.caltech.edu>
  5. Date: 2 Aug 90 19:50:56 GMT
  6.  
  7.  
  8. Am I missing something here, or will the
  9. following provide the desired function:
  10.  
  11. #!/bin/sh
  12. case $# in 2);;*)echo "usage: ${0:-newer} file1 file2" >&2;exit 2;;esac
  13. [ ! -f "$2" -o -f "$1" -a "X`/bin/ls -t \"\$1\" \"\$2\"`" = "X$1
  14. $2"] >/dev/null 2>&1
  15.  
  16.  
  17. I suppose this will fail if, for example, it is invoked as
  18. $ newer 'foo
  19. foo' 'foo'
  20. but people who put newlines in their filenames get what they deserve!
  21.