Xref: utzoo comp.unix.questions:24253 alt.sources:2134 Path: utzoo!attcan!uunet!jarthur!nntp-server.caltech.edu!mercury!fritz From: fritz@mercury.caltech.edu (Fritz Nordby) Newsgroups: comp.unix.questions,alt.sources Subject: Re: how to compare file modification time (whole dir tree?) Summary: /bin/ls is wonderful Message-ID: <1990Aug2.195056.4041@laguna.ccsf.caltech.edu> Date: 2 Aug 90 19:50:56 GMT References: <1990Jul23.233044.2729@silma.com> <1990Jul25.193309.16455@usenet.ins.cwru.edu> <1990Jul27.153223.12416@chinet.chi.il.us> <1446@chinacat.Unicom.COM> Sender: news@laguna.ccsf.caltech.edu Organization: California Institute of Technology Lines: 14 Am I missing something here, or will the following provide the desired function: #!/bin/sh case $# in 2);;*)echo "usage: ${0:-newer} file1 file2" >&2;exit 2;;esac [ ! -f "$2" -o -f "$1" -a "X`/bin/ls -t \"\$1\" \"\$2\"`" = "X$1 $2"] >/dev/null 2>&1 I suppose this will fail if, for example, it is invoked as $ newer 'foo foo' 'foo' but people who put newlines in their filenames get what they deserve!