[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: generate date sequences

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 <> 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



Thank you; I was not aware of the seq command.

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]