[Smaug] A quick scripting puzzle
Peter Belew
abcruzww at gmail.com
Sat Nov 19 08:33:31 PST 2005
I think cal is standard, though; no one has complained about it
not being there.
- Peter
On 11/19/05, Anthony Ettinger <apwebdesign at yahoo.com> wrote:
> gcal isn't standard
>
> --- Thomas Leavitt <thomas at thomasleavitt.org> wrote:
>
> > On Fri, 2005-11-18 at 08:43 -0800,
> > smaug-request at lists.svlug.org wrote:
> > > Message: 2
> > > Date: Thu, 17 Nov 2005 20:26:33 -0800
> > > From: Peter Belew <peterbe at sonic.net>
> > > Subject: [Smaug] A quick scripting puzzle
> > > To: SMAUG Users <smaug at lists.svlug.org>
> > > Message-ID: <20051118042633.GA6844 at sonic.net>
> > > Content-Type: text/plain; charset=us-ascii
> > >
> > > For amusement, create a 1-line sh or bash command
> > which will set
> > > a shell variable $LASTSUNDAY to the date (2-digit
> > day) of the last
> > > Sunday in the current month.
> > >
> > > Like
> > >
> > > LASTSUNDAY=`some_shell_stuff`
> > >
> > > Use only standard Unix utilities such as 'cat' or
> > 'head' or 'date'.
> > >
> > > The command shouldn't take longer than an
> > 80-character line.
> > >
> > > (I did this myself for creating a cron job which
> > sends out email
> > > announcing a meeting on the last sunday of a
> > month).
> > >
> > > :)
> > >
> > > Peter
> > >
> >
> > Here's my entry... I'm pretty sure, somewhere within
> > the byzantine array
> > of options available in gcal, there's a way to
> > directly produce this...
> > but I couldn't find it. However, this works, no
> > matter whether there are
> > four or five Sundays in a month.
> >
> > LASTSUNDAY=`gcal -i -s1|tail -n1|sed "s/[
> > ]*$//"|rev|cut -b-2|rev`
> >
> > I'm not sure how this works, but you could probably
> > cheat more, by
> > feeding gcal instructions to use some of these
> > commands from a file...
> >
> > and of course, I'm cheating, by using gcal, but hey.
> > :)
> >
> > Thomas
> >
> >
> >
> > _______________________________________________
> > 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