UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 48.5 leave: A Maddening Aid to Quitting on Time Chapter 48
Office Automation
Next: 48.7 cal That Marks Today's Date
 

48.6 Get Calendar for Any Month or Year: cal

What day were you born? If you were born on September 23, 1962, type this command to get a calendar for the month:

% cal 9 1962
   September 1962
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

You were born on a Sunday. Be sure to type all four digits of the year. If you don't, you'll get the calendar for 62 A.D.-almost 2000 years ago!

To get a calendar for the current month, just type cal (no arguments). You can also get the whole calendar for any year by giving a single argument: the year you want (use all four digits for any year in the last millennium).

There seems to be a bug in September 1752:

% cal 9 1752
   September 1752
Su Mo Tu We Th Fr Sa
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

But there isn't really a bug. That's when Great Britain and the (then) American colonies adopted the Gregorian calendar; what would have been September 3 became September 14, and the beginning of the year changed from March 25 to January 1. Hmmmph. Bugs - in UNIX? :-)

- JP


Previous: 48.5 leave: A Maddening Aid to Quitting on Time UNIX Power ToolsNext: 48.7 cal That Marks Today's Date
48.5 leave: A Maddening Aid to Quitting on Time Book Index48.7 cal That Marks Today's Date

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System