From owner-freebsd-questions Sat Oct 13 13:33:23 2001 Delivered-To: freebsd-questions@freebsd.org Received: from scaup.mail.pas.earthlink.net (scaup.mail.pas.earthlink.net [207.217.121.49]) by hub.freebsd.org (Postfix) with ESMTP id 74E4337B409 for ; Sat, 13 Oct 2001 13:33:20 -0700 (PDT) Received: from blossom.cjclark.org (dialup-209.247.138.84.Dial1.SanJose1.Level3.net [209.247.138.84]) by scaup.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id NAA17940; Sat, 13 Oct 2001 13:33:18 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id f9DKXGA62808; Sat, 13 Oct 2001 13:33:16 -0700 (PDT) (envelope-from cjc) Date: Sat, 13 Oct 2001 13:33:16 -0700 From: "Crist J. Clark" To: Mike Meyer Cc: Randy Bush , questions@FreeBSD.ORG Subject: Re: date of a file Message-ID: <20011013133316.E36620@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <73720831@toto.iv> <15303.43126.44123.116068@guru.mired.org> <20011013030023.M6274@blossom.cjclark.org> <15304.21677.127685.628179@guru.mired.org> <20011013122653.B36620@blossom.cjclark.org> <15304.40263.916320.437239@guru.mired.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15304.40263.916320.437239@guru.mired.org>; from mwm@mired.org on Sat, Oct 13, 2001 at 03:00:07PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Oct 13, 2001 at 03:00:07PM -0500, Mike Meyer wrote: > Crist J. Clark types: > > On Sat, Oct 13, 2001 at 09:50:21AM -0500, Mike Meyer wrote: > > > Crist J. Clark types: > > > > On Sat, Oct 13, 2001 at 12:23:59AM -0700, Randy Bush wrote: > > > > > > date +%y%m%d-%H%M%S -jf "%b %d %H:%M:%S" `ls -lT filename | awk ' { print $6, $7, $8, $9 } '` > > > > > > > > > > i have tried many variations on this, and all fail as follows: > > > > > > > I spoke too soon. It seems to be a problem with the way the shell > > parses the command line. For example, a script like, > > > > #!/bin/sh > > > > DATE=`ls -lT $1 | awk '{print $6, $7, $8, $9}'` > > > > date -j -f '%b %d %T %Y' "$DATE" +%y%m%d-%H%M%S > > > > Works fine. date(1) is fine. > > Ugh. RIght - it's the backtick quoting. You can do it on one line like > so: > > date -j -f '%b %d %T %Y' "`ls -lT /kernel | awk '{print $6, $7, $8, $9}'`" +%y%m%d-%H%M%S Actually, whether that line works or not depends on the shell you are using. -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message