|
From: | Colin S. Miller |
Subject: | Re: generate date sequences |
Date: | Mon, 31 Oct 2005 20:06:24 +0000 |
User-agent: | Debian Thunderbird 1.0.2 (X11/20051002) |
Andre Poenitz wrote:
Colin S. Miller <no-spam-thank-you@csmiller.demon.co.uk> wrote:for (( a=0 ; $a \< 10 ; a++ )) ;do date -d "5 april 2005 $a days";done Tue Apr 5 00:00:00 BST 2005 [...]Nice trick, that '$a days' thing. The preamble could have been a bit shorter, though: seq 10 | while read a; do date -d "5 april 2005 $a days"; done Regards, Andre'
Andre, Thank you; I was not aware of the seq command. However, it is not necessary to use 'read' when xargs will do the same, giving seq 0 10 | xargs -i date -5 "5 april 2005 {} days" Is there a shorter form? As I said before, I'm not sure if this is offically supported by GNU date. What I suspect is happening is that '-d "4 days" ' adds 4 days to date's current time, which I previously set to 5 april. Colin S. Miller -- Replace the obvious in my email address with the first three letters of the hostname to reply.
[Prev in Thread] | Current Thread | [Next in Thread] |