# Calculate days on which Friday the 13th occurs

for y in \$(seq 1996 2018); do echo -n "\$y -> "; for m in \$(seq 1 12); do NDATE=\$(date --date "\$y-\$m-13" +%A); if [ \$NDATE == 'Friday' ]; then PRINTME=\$(date --date "\$y-\$m-13" +%B);echo -n "\$PRINTME "; fi; done; echo; done
Simply change the years listed in the first seq, and it will print out all the months in that span of years that have Friday the 13ths in them.
Sample Output
```2010 -> August
2011 -> May
2012 -> January April July
2013 -> September December
2014 -> June
2015 -> February March November
2016 -> May
2017 -> January October
2018 -> April July ```

1
2018-06-13 20:11:46

## 4 Alternatives + Submit Alt

• I removed the dependency of the English language Show Sample Output

5
for y in \$(seq 1996 2018); do echo -n "\$y -> "; for m in \$(seq 1 12); do NDATE=\$(date --date "\$y-\$m-13" +%w); if [ \$NDATE -eq 5 ]; then PRINTME=\$(date --date "\$y-\$m-13" +%B);echo -n "\$PRINTME "; fi; done; echo; done
· 2018-06-25 09:20:57
• Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale. Show Sample Output

3
for i in {2018..2025}-{01..12}-13; do [[ \$(date --date \$i +"%u" | grep 5) != 5 ]] || echo "\$i Friday the 13th"; done
· 2018-07-10 21:31:02
• Alter the years in the first brace expansion to select your year range. Modify date format to your liking but leave " %w" at the end. Show Sample Output

1
for i in {2018..2022}-{01..12}-13; do date --date \$i +"%Y %B %w" | sed '/[^5]\$/d; s/ 5*\$//'; done
· 2018-07-09 15:47:39
• Removed grep and simplified if statement. -- Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale. Show Sample Output

0
for i in {2018..2025}-{01..12}-13; do [[ \$(date --date \$i "+%u") == 5 ]] && echo "\$i Friday the 13th"; done
· 2018-07-30 15:54:24

### What Others Think

I really got into this article. I found it to be interesting and loaded with unique points of interest. I like to read material that makes me think. Thank you for writing this great content. ?????
wenilak444 · 21 weeks and 1 day ago
You have beaten yourself this time, and I appreciate you and hopping for some more informative posts in future. Thank you for sharing great information to us. ???????
wenilak444 · 21 weeks ago
Amazing! This blog looks just like my old one! It's on a completely different subject but it has pretty much the same layout and design. Wonderful choice of colors! Pug Puppies for Sale Near Me PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under \$500 Near Me pug puppies for sale in texas pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio
rahimhh21 · 16 weeks and 1 day ago
La formation en ligne en gestion d'entreprise peut être un excellent moyen d'acquérir les compétences dont vous avez besoin pour gérer une entreprise prospère. Les meilleurs cours de gestion d'entreprise en ligne couvrent des sujets tels que la gestion financière, le marketing et les ressources humaines. En suivant un cours en ligne, vous serez en mesure d'apprendre à votre propre rythme et dans votre propre temps. De plus, vous aurez accès à des instructeurs experts qui pourront répondre à toutes vos questions. Que vous cherchiez à créer votre propre entreprise ou que vous en dirigiez déjà une, un cours de gestion d'entreprise en ligne peut vous aider à faire passer votre entreprise au niveau supérieur. formation gestion d'entreprise
wenilak444 · 16 weeks ago
Hey, you used to write fantastic, but the last several posts have been kinda boring… I miss your tremendous writings. Past few posts are just a little out of track! come on! navigate to the closest grocery store
wenilak444 · 15 weeks and 5 days ago
I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... iso merchant services
wenilak444 · 15 weeks and 2 days ago
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! kanye wallpaper iphone
wenilak444 · 15 weeks and 2 days ago
Heya i am for the primary time here. I came across this board and I to find It really helpful & it helped me out much. I’m hoping to give something back and help others like you helped me. ????
wenilak444 · 15 weeks and 1 day ago
As I website possessor I believe the content material here is rattling wonderful , appreciate it for your hard work. You should keep it up forever! Good Luck. iso merchant processing
wenilak444 · 13 weeks and 5 days ago
Pug pups for sale are utterly gorgeous, affectionate, and intelligent. Excellent pedigrees, gorgeous coats, finely formed ears, a tight, curled tail, outstanding faces, and a superb conformation like their parents are all present in these puppies. The parents are both in wonderful health and are kind and devoted family members. They will arrive fully registered with the AKC, with pedigree papers, and with a one-year health guarantee. Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under \$500 Near Me pug puppies for sale in texas pug puppies for sale \$200 pugs for sale near me under \$500 pugs for sale under \$400 near me pugs for sale near me puppies for sale near me under \$500 pug puppies for sale under \$1,000 near me pug for sale pug puppies for sale under \$300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under \$500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale \$200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
ExcellentHome · 12 weeks and 5 days ago
Hi I was searching for the blogs for many times, now I have reached at the right place. web designing companies
martinduke · 10 weeks and 6 days ago
An fascinating discussion is value comment. I feel that you must write extra on this matter, it may not be a taboo topic but generally individuals are not enough to speak on such topics. To the next. Cheers deep web
wenilak444 · 6 weeks and 2 days ago
Took me awhile to read all the comments, but I really enjoyed the article. It proved to be very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! I’m sure you had fun writing this article. dark web sites
wenilak444 · 6 weeks and 2 days ago
Do you mind if I quote a few of your posts as long as I provide credit and sources back to your webpage? My blog site is in the very same area of interest as yours and my users would truly benefit from a lot of the information you provide here. Please let me know if this ok with you. Thanks a lot! work from home jobs
wenilak444 · 6 weeks and 2 days ago
Thanks for some other excellent article. Where else could anyone get that kind of information in such a perfect way of writing? I’ve a presentation next week, and I am at the look for such info. affiliate marketing
wenilak444 · 6 weeks and 2 days ago
I just like the valuable information you provide in your articles. I’ll bookmark your weblog and take a look at once more right here frequently. I am quite certain I’ll learn lots of new stuff right here! Good luck for the following! automatic sliding glass door bd
wenilak444 · 6 weeks and 2 days ago

### What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.