A three-month Bash calendar

The cal command displays a simple calendar; but, like most calendars, it displays the months one at a time.

Here is a Bash script, calendar3, that displays three months in sequence.  It was written on Ubuntu MATE 20.04.


russell@focal-desktop:~$ calendar3

 July-August-September 2020
 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 
 19 20 21 22 23 24 25 
 26 27 28 29 30 31  1 
  2  3  4  5  6  7  8 
  9 10 11 12 13 14 15 
 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 
 30 31  1  2  3  4  5 
  6  7  8  9 10 11 12 
 13 14 15 16 17 18 19 
 20 21 22 23 24 25 26 
 27 28 29 30 

russell@focal-desktop:~$ calendar3 -6 -mwj

 January-February-March 2020
 Mo     Tu     We     Th     Fr     Sa     Su      week
                1|001  2|002  3|003  4|004  5|005    01
  6|006  7|007  8|008  9|009 10|010 11|011 12|012    02
 13|013 14|014 15|015 16|016 17|017 18|018 19|019    03
 20|020 21|021 22|022 23|023 24|024 25|025 26|026    04
 27|027 28|028 29|029 30|030 31|031  1|032  2|033    05
  3|034  4|035  5|036  6|037  7|038  8|039  9|040    06
 10|041 11|042 12|043 13|044 14|045 15|046 16|047    07
 17|048 18|049 19|050 20|051 21|052 22|053 23|054    08
 24|055 25|056 26|057 27|058 28|059 29|060  1|061    09
  2|062  3|063  4|064  5|065  6|066  7|067  8|068    10
  9|069 10|070 11|071 12|072 13|073 14|074 15|075    11
 16|076 17|077 18|078 19|079 20|080 21|081 22|082    12
 23|083 24|084 25|085 26|086 27|087 28|088 29|089    13
 30|090 31|091 

russell@focal-desktop:~$ calendar3 -h

Displays three months in continuous sequence.
Default display is the previous, current, and next months,
with the current date highlighted.

Usage: calendar3 [options]

<number>
       Go to the month <number> month(s) before or after the current month
       (negative = before, positive = after).

<yyyy-m> | <m-yyyy>
       Go to the specified month and year.

<yyyy-m-d> | <m-d-yyyy>
       Go to the specified month and year, and highlight the date.

-m     Week starts on Monday (default is Sunday).

-w     Show week numbers.
       If week starts on Sunday, week 1 starts on January 1.
       If week starts on Monday, week 1 is the first week of the year
       with a Thursday (ISO week number).

-W <yyyy-w> | <w-yyyy>
       Go to the specified week number.
       If week is to start on Monday, specify that first.

-j     Show Julian dates.

-J <yyyy-d> | <d-yyyy>
       Go to the specified Julian date.

-Y [<yyyy-m> | <m-yyyy>]
       Show the whole year, in quarters.
       Beginning month and year are optional.

-c     No colors or highlighting.

-h     Display this help and exit.

Examples:

The big day
       calendar3 11-3-2020

ISO week number
       calendar3 -mw

Julian date 48 of year 2017
       calendar3 -J 48-2017

Save as plain text
       calendar3 -c > file.txt

Please visit russellcottrell.com.


russell@focal-desktop:~$ 


Copy it to one of the $PATH folders (~/bin in my case) to run it by name.


Please visit russellcottrell.com | blog