[sf-lug] SF-LUG meeting notes for Sunday June 2, 2019

Rick Moen rick at linuxmafia.com
Tue Jun 4 09:15:05 PDT 2019


Quoting Akkana Peck (akkana at shallowsky.com):

> Rick Moen writes:
> > Quoting Alex Kleider (akleider at sonic.net):
> > 
> > > I tried your script:
> > 
> > Short version:  It turns out I assumed GNU awk, but failed to say so.
> 
> How's this? (Add to your .bashrc or wherever.)
> 
> dayofweek() {
>     echo -n "Date as YYYY-MM-DD: "
>     read d
>     date --date=$d
> }
> 
> If you really only want the day, change the last line to
> 
>     date --date=$d +%a
> 
>         ...Akkana

This is probably a stupid question, but:  How would that bash function  
be used in a daysuntil script such as the one I included in
http://linuxmafia.com/faq/Linux_PR/newlug.html item #12?  And are you
saying it somehow averts any need for specifically _GNU_ awk (which I
invoked for its mktime & systime functions)? 

Strictly speaking, my daysuntil script claims to be a Bourne (as opposed
to bash) script (per the shebang I less-than-mindfully employed), but
the real thing is I'm unclear on how the above dayofweek bash shell
function is related to the use-case.  (Could be just lack of coffee.)

Context of my daysutil script:  I'd frequently found myself wanting to
know how many calendar days in the future a projected LUG event date is,
and therefore scribbled down that modest shell / awk recipe as a tool to
fill in the gap -- saving time over getting a calendar and counting
date boxes.  And then it occurred to me that it's a thing LUG planners 
everywhere might also need, so I threw it into my 19-year-old essay
'Recipe for a Successful Linux User Group'.

Of course, if you and other coders want to just play with the concept
and improve it, great!  Personally, I find date handling and arithmetic a
nightmare, and was glad I could leverage GNU awk's mktime & systime
functions so as to make the whole headache go away.




More information about the sf-lug mailing list