Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ulysses!ulysses.att.com!mab From: mab@ulysses.att.com (Muhammad Basit) Newsgroups: comp.unix.questions Subject: Re: how to compare file modification time in bourne shell script Message-ID: <13460@ulysses.att.com> Date: 25 Jul 90 13:10:48 GMT References: <1990Jul23.233044.2729@silma.com> Sender: netnews@ulysses.att.com Organization: AT&T Bell Laboratories, Murray Hill Lines: 24 In article <1990Jul23.233044.2729@silma.com> aab@silma.UUCP () writes: > >I need to compare the modification times of two files in a bourne shell >script. I would like to do this without writing C code. >Machine is Sparcstation 1 running SunOS 4.03c >Thus I need a function: >newer file1 file2 >that returns 0 if file1 is newer than file2 else returns 1 Another way you might find useful is to use find. e.g.: find mbox -newer .profile -exec date \; will execute the command date if 'mbox' is newer than '.profile' I think you can use it for your work with little effort. >Andy Burgess Muhammad Basit --------------- Muhammad Basit A person's mind is like a parachute: Email: mab@ulysses.ATT.COM To work it first has to be open. Basit@Mars.NJIT.EDU - I. Dont Remember