[Smaug] A quick scripting puzzle

Peter Belew peterbe at sonic.net
Thu Nov 17 20:26:33 PST 2005


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

-- 
      My Web:       http://www.armory.com/~peterbe/ 
      News:         http://www.sonic.net/~peterbe/news.html
      Humor:        http://www.ibiblio.org/Dave/this-week.html
      Goat:         http://www.livejournal.com/site/goat.bml
      (I'm 'velikij' on LJ)



More information about the Smaug mailing list