On Tue, Jul 05, 2005 at 05:23:24PM -0400, douglas.r.aker@verizon.com wrote:
I'm looking for a standard Unix shell command that can list an arbitrary number of day dates backwards from today. For example, something like this:
$ unixcommand -7 Tuesday July 5 2005 Monday July 4 2005 Sunday July 3 2005 [...]
Command must transit months, years, leap-years, etc.
Nothing comes to mind, but I'd do something like: $ perl -e 'for($i=0;$i<=$ARGV[0];$i++){ print scalar(localtime(time-86400*$i)),"\n"; }' 7 Tue Jul 5 17:31:35 2005 Mon Jul 4 17:31:35 2005 Sun Jul 3 17:31:35 2005 [...] Or if you need that other specific format: #!/usr/bin/perl my @mon = qw/January February March April May June July August September October November December/; my @day = qw/Sunday Monday Tuesday Wednesday Thursday Friday Saturday/; my $time = time; my $count = $ARGV[0]; while($count--) { my @lt = localtime($time); print join(" ", $day[$lt[6]], $mon[$lt[4]], $lt[3], 1900+$lt[5]),"\n"; $time -= 86400; } $ perl script 7 Tuesday July 5 2005 Monday July 4 2005 Sunday July 3 2005 [...] -- Randomly Generated Tagline: "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams