calendar Command

Purpose

Writes reminder messages to standard output.

Syntax

calendar]

Description

The calendar command reads the calendar file and displays any line in the file that contains today's or tomorrow's date. The calendar file is user-created and must be in the same directory from which you run the calendar command. Typically, the calendar file resides in your home directory.

If you run the calendar command on a Friday, the calendar command displays all lines containing the dates for that Friday as well as the subsequent Saturday, Sunday, and Monday. The command does not recognize holidays.

The calendar command recognizes date formats such as Month Day, Abbreviation Date, and MonthNumeral/Date. Examples of these formats include December 7, Dec. 7 and 12/7. The calendar command also recognizes the special character * (asterisk) when followed by a / (slash). It interprets */7, for example, as signifying the seventh day of every month. The calendar command does not recognize formats such as 7/*, 7 December, 7/12, * 7 or DEC. 7.

If the system administrator has created a calendar file for all users, you can access this file by placing the following line at the beginning of your local calendar file:

#include <FileName>

The actual value of the FileName variable is determined by the system administrator. The name of this file does not have to be calendar. When you run the calendar command, it displays reminders that were stored in your local calendar file as well as those stored in the file specified by the FileName variable.

Note: When the calendar file contains include statements, the calendar command runs the calendar file through the C preprocessor. To use include statements with the calendar file, the C preprocessor, which is contained in the /usr/ccs/lib/cpp file, must be installed on the operating system.

For you to get reminder service, your calendar file must have read permission for others. See the chmod command for information on setting permissions.

Flag

Item Description
- Calls the calendar command for everyone having a calendar file in the home directory. The calendar command sends reminders using the mail command instead of writing the results to standard output.

Exit Status

This command returns the following exit values:

Item Description
0 Successful completion.
>0 An error occurred.

Examples

  1. A typical calendar file might look like the following:
    */25 - Prepare monthly report
    Aug. 12 - Fly to Denver
    aug 23 - board meeting
    Martha out of town - 8/23, 8/24, 8/25
    8/24 - Mail car payment
    sat aug/25 - beach trip
    August 27 - Meet with Simmons
    August 28 - Meet with Wilson
    To run the calendar command, enter:
    calendar
    If today is Friday, August 24, then the calendar command displays the following:
    */25 - Prepare monthly report
    Martha out of town - 8/23, 8/24, 8/25
    8/24 - Mail car payment
    sat aug/25 - beach trip
    August 27 - Meet with Simmons
  2. A calendar file that contains an include statement might look like the following:
    #include </tmp/out>
    1/21 -Annual review
    1/21 -Weekly project meeting
    1/22 *Meet with Harrison in Dallas*
    Doctor's appointment - 1/23
    1/23 -Vinh's wedding
    To run the calendar command, enter:
    calendar
    If today is Wednesday, January 21, then the calendar command displays the following:
    Jan.21 Goodbye party for David
    Jan.22 Stockholder meeting in New York
    1/21 -Annual review
    1/21 -Weekly project meeting
    1/22 *Meet with Harrison in Dallas*
    The results of the calendar command indicate the /tmp/out file contained the following lines:
    Jan.21 Goodbye party for David
    Jan.22 Stockholder meeting in New York

Files

Item Description
$HOME/calendar Contains the calendar command.
/usr/lib/calprog Contains the program that determines dates.
/usr/ccs/lib/cpp Contains the C preprocessor.
/etc/passwd Contains basic user attributes.