[Smaug] A quick scripting puzzle
Peter Belew
abcruzww at gmail.com
Fri Nov 18 07:46:54 PST 2005
Wow!
On 11/18/05, Anthony Ettinger <apwebdesign at yahoo.com> wrote:
> echo `cal|rev`|rev|cut -b-2
That's really clever!
- Peter
>
>
>
> --- cerise at armory.com wrote:
>
> > I can top that! This is 59 chars.
> >
> > LASTSUNDAY=`cal | grep [0-9] | sed s/[ ].*//g | tail
> > -n 1`
> >
> > -Phil/CERisE
> >
> > On Thu, Nov 17, 2005 at 09:13:01PM -0800, Jay
> > Campbell wrote:
> > >
> > > You'd have to escape the backticks to use this
> > inside the
> > > LASTSUNDAY example backticks, and on re-parsing
> > the question
> > > it asked for the date, not just day-of-month, so
> > you'd have
> > > to tack more characters into the second `date`s
> > format string.
> > >
> > > So I'm over 80 characters anyway. The practice of
> > shaving bytes
> > > off code like this is called 'golfing' in some
> > circles (i.e. perl)
> > >
> > > j
> >
> > _______________________________________________
> > Smaug mailing list
> > Smaug at lists.svlug.org
> > http://lists.svlug.org/lists/listinfo/smaug
> > Smaug home page: http://www.scruz.org/
> >
>
>
> Anthony Ettinger
> ph: (408) 656-2473
> web: http://www.apwebdesign.com
>
> _______________________________________________
> Smaug mailing list
> Smaug at lists.svlug.org
> http://lists.svlug.org/lists/listinfo/smaug
> Smaug home page: http://www.scruz.org/
>
>
More information about the Smaug
mailing list