Module 10 cal

Previous Table of Contents Next


Module 10
cal

DESCRIPTION

The external cal command generates a simple calendar and writes it to the standard output. The default output for cal is the current month. Using the arguments listed, a specific year or year and month can be created. Valid years are from 1 to 9999. Valid months are in the range of 1 through 12. The calendar produced is the English/United States standard.

COMMAND FORMAT

Following is the general format of the cal command.

 cal [ [ month ] year ] 

Arguments

The following list describes the arguments that may be passed to the cal command.

year Produces calendar for the given year.
month Produces a calendar for the specified month of the given year.

Remember that a single argument will return the calendar for the given year. The year must be a complete number, i.e., if you want to create the calendar for 1980, you must enter 1980. If you just enter 80 the calendar for 80 A.D. is displayed.

FURTHER DISCUSSION

A strange calendar is produced for September 1752. Because leap years were not accounted for until this time, 11 days were skipped to make the correct adjustment. To display this calendar, type cal 9 1752 and press Return. Your screen should resemble the following display:

 cj> 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 

DIAGNOSTICS AND BUGS

The assumption is made that each year always starts in January even though this is historically incorrect.

The command format cal 45 will return the calendar for the ealy Christian era, not the calendar for 1945.

RELATED COMMANDS

Refer to the date and calendar commands described in modules 30 and 11.

RELATED FILES

The cal command writes to the standard output.

APPLICATIONS

The cal command is used to generate human readable calendars for everyday use. It is a useful on-line utility that saves you from having to look up a day or date on a paper calendar.

TYPICAL OPERATION

In this activity you use the cal command to create a calendar for an entire year and one for a single month. Begin at the shell prompt.

1.    Type cal 1752 and press Return . Notice a calendar for each month of 1752 is generated. The month of September is correct. These days were skipped to correct the fact that leap years were not being recognized every four years.
2.    Type cal 1 1989 and press Return . Your screen should resemble the following display:
 cj> cal 1 1989            January 1989        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 
3.     Turn to Module 11 to continue the learning sequence.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net