[Smaug] A quick scripting puzzle

Anthony Ettinger apwebdesign at yahoo.com
Fri Nov 18 02:01:34 PST 2005


echo `cal|rev`|rev|cut -b-2



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



More information about the Smaug mailing list