[Eug-lug] shell evilness

Jason LaPier jlapier at uoregon.edu
Thu Jul 6 14:19:04 PDT 2006



> -----Original Message-----
> From: euglug-bounces at euglug.org 
> [mailto:euglug-bounces at euglug.org] On Behalf Of larry price
> Sent: Thursday, July 06, 2006 11:20 AM
> To: Eugene Unix and Gnu/Linux User Group
> Subject: Re: [Eug-lug] shell evilness
> 
> well now,
> 
> larry at bluejay:~/week$ rm -r *;for d in 1 2 3 4 5 6 7; do mkdir `date
> -v+${d}d +%A`; done
> larry at bluejay:~/week$ ls
> Friday          Monday          Saturday        Sunday
> Thursday        Tuesday         Wednesday
> 
> 
> works on systems from Freebsd 4.11 to 6.1
> 
> the disappearance of the -v option from other forms of date 
> seems counterproductive.


If I understand correctly what you're trying to do:

$ date 
Thu Jul  6 14:17:48 PDT 2006 

$ date -d "today + 1 day" 
Fri Jul  7 14:17:56 PDT 2006 

$ date +%A 
Thursday 

$ date -d "today + 1 day" +%A 
Friday 

That help?

- Jason


> 
> 
> 
> On 7/6/06, Patrick R. Wade <prwade at oip.net> wrote:
> > larry price wrote:
> > > mkdir $(for d in 1 2 3 4 5 6; do eval "date -v+${d}d +%A";done)
> > >
> > > challenge to the perl monks; do the same thing in fewer 
> characters...
> >
> > prwade at lusitania:~$ uname -a
> > Linux lusitania 2.6.15-23-server #1 SMP Tue May 23 15:10:35 UTC 2006
> > i686 GNU/Linux
> > prwade at lusitania:~$ ( export d=1 ; date -v+${d}d +%A )
> > date: invalid option -- v
> > Try `date --help' for more information.
> > prwade at lusitania:~$
> >
> >
> > --
> > On two occasions I have been asked [by members of 
> Parliament!], 'Pray, 
> > Mr. Babbage, if you put into the machine wrong figures, 
> will the right 
> > answers come out?' I am not able rightly to apprehend the kind of 
> > confusion of ideas that could provoke such a question.
> >         -- Charles Babbage
> > _______________________________________________
> > EUGLUG mailing list
> > euglug at euglug.org
> > http://www.euglug.org/mailman/listinfo/euglug
> >
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
> 



Jason LaPier
Network Manager
TACS / WRRC / NPSO
University of Oregon



More information about the EUGLUG mailing list