From owner-freebsd-questions Sat Oct 13 7:54:24 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-31-203-60.mmcable.com [65.31.203.60]) by hub.freebsd.org (Postfix) with SMTP id 96B5C37B406 for ; Sat, 13 Oct 2001 07:50:21 -0700 (PDT) Received: (qmail 38062 invoked by uid 100); 13 Oct 2001 14:50:21 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15304.21677.127685.628179@guru.mired.org> Date: Sat, 13 Oct 2001 09:50:21 -0500 To: cjclark@alum.mit.edu Cc: Randy Bush , questions@FreeBSD.ORG Subject: Re: date of a file In-Reply-To: <20011013030023.M6274@blossom.cjclark.org> References: <73720831@toto.iv> <15303.43126.44123.116068@guru.mired.org> <20011013030023.M6274@blossom.cjclark.org> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ 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 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: > > > > rip.psg.com:/usr/home/randy> date -j +%y%m%d-%H%M%S -f '%b %d %T %Y' `ls -lT 2borg | awk '{print $6, $7, $8, $9}'` > > date: illegal time format > > usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... > > [-f fmt date | [[[[[cc]yy]mm]dd]HH]MM[.ss]] [+format] > > > > yes, this all seems in accord with what 'man strftime' shows me. > > It has to do with how date(1) reads the command line. Basically, the > '+ format' and '-f format date' options are not compatible. This > appears to be a bug, but it would be really tricky to > fix. (Hmm... maybe not...) Send in a PR if you would like so it gets > into the system. Have a look at date.c. It is pretty clear what is > happening. Feel free to submit a fix with a PR. Considering that the man page says: -j Do not try to set the date. This allows you to use the -f flag in addition to the + option to convert one date format to another. It's *definitely* a bug. Randy, if you're not going to file a PR, let me know and I will. http://www.mired.org/home/mwm/ Q: How do you make the gods laugh? A: Tell them your plans. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message