Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #12083

Re: Only one Friday 13th coming in 2016

From Ralf Goertz <me@myprovider.invalid>
Newsgroups gnu.bash.bug
Subject Re: Only one Friday 13th coming in 2016
Date 2015-12-22 14:43 +0100
Organization solani.org
Message-ID <20151222144353.323afe4a@delli.goertz.local> (permalink)
References <slrnn7g4tl.2r3t.knock_yourself_out@vps.jonz.net> <20151221151338.GW27325@eeg.ccf.org> <20151222010544.GA21298@linda> <1450753456.7845.5.camel@16bits.net> <mailman.375.1450790195.843.bug-bash@gnu.org>

Show all headers | View raw


Am Tue, 22 Dec 2015 08:16:28 -0500
schrieb Greg Wooledge <wooledg@eeg.ccf.org>:

> On Tue, Dec 22, 2015 at 04:04:16AM +0100, Ángel González wrote:
> > Aren't you making things more complex than needed, with so much
> > pipes and awk?
> > 
> > date(1) is your friend:
> > 
> > For instance:
> >  $ for y in {1900..2199} ; do echo -n "$y "; for m in {1..12}; do
> > date +%A -d $y-$m-13; done | grep -c Friday ; done
> > 
> > shows there are between 1 and 3 Fridays per year.
> 
> This is the most obvious approach, but it does a fair amount of
> forking. Also, you're relying on GNU date. 

And on the assumption that Friday is called „Friday“ in the used locale
which is a bit surprising since Ángel's name suggests that it is called
differently in his native locale. It is called „Freitag“ in mine so I
got no Friday 13th at all.

Back to gnu.bash.bug | Previous | NextPrevious in thread | Find similar


Thread

Re: Only one Friday 13th coming in 2016 Greg Wooledge <wooledg@eeg.ccf.org> - 2015-12-22 08:16 -0500
  Re: Only one Friday 13th coming in 2016 Ralf Goertz <me@myprovider.invalid> - 2015-12-22 14:43 +0100

csiph-web