Re: Weekday abbreviations in output of cal(1)

2020-07-02 Thread Valery Ushakov
Valery Ushakov wrote: > Wolfgang Solfrank wrote: > >>> "first $WEEKDAY of next month". I am at a loss how to do this with >>> NetBSD's date(1). >> >> Thanks for the explanation. >> >> Ok, let's try with a double invocation: >> >> $ date -d "$(date -d '+1 month' '+%m/01/%C%y') sat" >> Sat

Re: Weekday abbreviations in output of cal(1)

2020-07-02 Thread Martin Neitzel
Hi Wolfgang, >> "first $WEEKDAY of next month". I am at a loss how to do this > $ date -d "$(date -d '+1 month' '+%m/01/%C%y') sat" > Sat Aug 1 00:00:00 CEST 2020 Nifty -- I would probably never have solved this. Thanks! Martin Neitzel

Re: Weekday abbreviations in output of cal(1)

2020-07-02 Thread Wolfgang Solfrank
Hi, Because yesterday was unsuitable to check for the ambiguity how the second "1" in that expression is actually parsed. Is it parsed as in: (+1 month 1) thu as in "go next month, its 1st, forward to Thursday", or is it: +1 month (1 thu) as in "go next month (same day as

Re: Weekday abbreviations in output of cal(1)

2020-07-02 Thread Martin Neitzel
> > I am not 100% sure how to do the job with NetBSD's date(1). I may > > be just lucky with > > % date -d '+1 month 1 thu' > > Thu Aug 6 00:00:00 CEST 2020 > > because today is the 1st of July. > > Why wait? Try [...] Because yesterday was unsuitable to check for the ambiguity how the

Re: Weekday abbreviations in output of cal(1)

2020-07-01 Thread Wolfgang Solfrank
Hi, I am not 100% sure how to do the job with NetBSD's date(1). I may be just lucky with % date -d '+1 month 1 thu' Thu Aug 6 00:00:00 CEST 2020 because today is the 1st of July. I better recheck this in a fortnight. Why wait? Try for i in 1 2 3 4 5 6 7 8 9 10 do date -d

Re: Weekday abbreviations in output of cal(1)

2020-07-01 Thread Martin Neitzel
TL`DR: I wouldn't mind the SuMoTuWeThFrSa change in cal(1) but I don't really give a damn either way. MS> Well, how would you use date(1) to return the number of days in any MS> given month, for example? % xargs -I MON date -d '1-MON +1 month -1 day' +'%m %d' july 07

Re: Weekday abbreviations in output of cal(1)

2020-06-30 Thread Michael Siegel
Am 30.06.20 um 11:38 schrieb Martin Husemann: > On Tue, Jun 30, 2020 at 11:24:51AM +0200, Michael Siegel wrote: >> Well, how would you use date(1) to return the number of days in any >> given month, for example? > > Good example, slightly complex but still close to cal|wc ;-) > > Martin > >

Re: Weekday abbreviations in output of cal(1)

2020-06-30 Thread Martin Husemann
On Tue, Jun 30, 2020 at 11:24:51AM +0200, Michael Siegel wrote: > Well, how would you use date(1) to return the number of days in any > given month, for example? Good example, slightly complex but still close to cal|wc ;-) Martin --8<-- #! /bin/sh YEAR=2020 MONTH=6 if [ $MONTH -lt 12 ]; then

Re: Weekday abbreviations in output of cal(1)

2020-06-30 Thread Michael Siegel
Am 30.06.20 um 10:59 schrieb Martin Husemann: > On Tue, Jun 30, 2020 at 10:53:38AM +0200, Michael Siegel wrote: >> Also, to the best of my knowledge, parsing the output of cal(1) is about >> the only method to get certain calendar information in Unix shell >> scripts. > > Now that makes me

Re: Weekday abbreviations in output of cal(1)

2020-06-30 Thread Martin Husemann
On Tue, Jun 30, 2020 at 10:53:38AM +0200, Michael Siegel wrote: > Also, to the best of my knowledge, parsing the output of cal(1) is about > the only method to get certain calendar information in Unix shell > scripts. Now that makes me curious - can you give an example? I think almost always

Re: Weekday abbreviations in output of cal(1)

2020-06-30 Thread Michael Siegel
Am 30.06.20 um 00:02 schrieb Kimmo Suominen: > On Mon, Jun 29, 2020 at 11:29:10AM -0700, Paul Goyette wrote: >> Also note that when using ``cal -r'' it still displays 5 lines of >> output, even though only 3 (or 4) lines contain any day-numbers. >> This results in somewhat excessive vertical

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Jeremy C. Reed
Version 5 Unix: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/cal.c chardayw[] { " S M Tu W Th F S" }; Two decades later, 4.4BSD had char *day_headings = " S M Tu W Th F S"; I find it interesting that the cal/ncal manual from a Ubuntu systems says "The

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Kimmo Suominen
On Mon, Jun 29, 2020 at 11:29:10AM -0700, Paul Goyette wrote: > Also note that when using ``cal -r'' it still displays 5 lines of > output, even though only 3 (or 4) lines contain any day-numbers. > This results in somewhat excessive vertical white-spacing. When outputting a full year (and

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Kimmo Suominen
On Mon, Jun 29, 2020 at 11:49:03AM -0700, Tom Spindler (moof) wrote: > What do the non-en languages do? Based on a quick inspection, "different things." :) The time category of our NLS data includes short weekday names: https://github.com/NetBSD/src/tree/trunk/share/locale/time Two-letter

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Rhialto
On Mon 29 Jun 2020 at 11:49:03 -0700, Tom Spindler (moof) wrote: > What do the non-en languages do? In Dutch one often sees ma di wo do vr za zo. -Olaf. -- Olaf 'Rhialto' Seibert -- rhialto at falu dot nl ___ Anyone who is capable of getting themselves made President should on \X/ no account

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Tom Spindler (moof)
On Mon, Jun 29, 2020 at 03:49:56PM +0200, Michael Siegel wrote: > > So, I'd say that, maybe, changing cal(1) in NetBSD to use two-letter > abbreviations throughout as well would also be a good thing concerning > compatibility with what other (widely-used) Unix-like operating systems do. While I

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Paul Goyette
Also note that when using ``cal -r'' it still displays 5 lines of output, even though only 3 (or 4) lines contain any day-numbers. This results in somewhat excessive vertical white-spacing. :) # cal -r September 1752 S M Tu W Th F S 1 2 14 15 16

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Valery Ushakov
Michael Siegel wrote: > So, in the output of NetBSD's cal(1), days are abbreviated with one > letter, except for Tuesday and Thursday. > > I'd say this is: > > * inconsistent > * potentially misleading (Saturday and Sunday are both just "S".) > * unnecessarily cryptic [...] > So, I'd say

Re: Weekday abbreviations in output of cal(1)

2020-06-29 Thread Kimmo Suominen
On Mon, Jun 29, 2020 at 03:49:56PM +0200, Michael Siegel wrote: > So, in the output of NetBSD's cal(1), days are abbreviated with one > letter, except for Tuesday and Thursday. I think it makes sense to always use two letters as more than half of the weekdays would need that to avoid ambiguity

Weekday abbreviations in output of cal(1)

2020-06-29 Thread Michael Siegel
Hello, looking at the output of cal(1) on NetBSD today, I noticed a bit of an oddity with how weekdays are abbreviated. Here's a comparison between Linux and NetBSD: # Linux $ LC_ALL=C cal 5 2019 May 2019 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18