1CAL(1P) POSIX Programmer's Manual CAL(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 cal — print a calendar
13
15 cal [[month] year]
16
18 The cal utility shall write a calendar to standard output using the
19 Julian calendar for dates from January 1, 1 through September 2, 1752
20 and the Gregorian calendar for dates from September 14, 1752 through
21 December 31, 9999 as though the Gregorian calendar had been adopted on
22 September 14, 1752.
23
24 If no operands are given, cal shall produce a one-month calendar for
25 the current month in the current year. If only the year operand is
26 given, cal shall produce a calendar for all twelve months in the given
27 calendar year. If both month and year operands are given, cal shall
28 produce a one-month calendar for the given month in the given year.
29
31 None.
32
34 The following operands shall be supported:
35
36 month Specify the month to be displayed, represented as a decimal
37 integer from 1 (January) to 12 (December).
38
39 year Specify the year for which the calendar is displayed, repre‐
40 sented as a decimal integer from 1 to 9999.
41
43 Not used.
44
46 None.
47
49 The following environment variables shall affect the execution of cal:
50
51 LANG Provide a default value for the internationalization vari‐
52 ables that are unset or null. (See the Base Definitions vol‐
53 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
54 ables for the precedence of internationalization variables
55 used to determine the values of locale categories.)
56
57 LC_ALL If set to a non-empty string value, override the values of
58 all the other internationalization variables.
59
60 LC_CTYPE Determine the locale for the interpretation of sequences of
61 bytes of text data as characters (for example, single-byte as
62 opposed to multi-byte characters in arguments).
63
64 LC_MESSAGES
65 Determine the locale that should be used to affect the format
66 and contents of diagnostic messages written to standard
67 error, and informative messages written to standard output.
68
69 LC_TIME Determine the format and contents of the calendar.
70
71 NLSPATH Determine the location of message catalogs for the processing
72 of LC_MESSAGES.
73
74 TZ Determine the timezone used to calculate the value of the
75 current month.
76
78 Default.
79
81 The standard output shall be used to display the calendar, in an
82 unspecified format.
83
85 The standard error shall be used only for diagnostic messages.
86
88 None.
89
91 None.
92
94 The following exit values shall be returned:
95
96 0 Successful completion.
97
98 >0 An error occurred.
99
101 Default.
102
103 The following sections are informative.
104
106 Note that:
107
108
109 cal 83
110
111 refers to A.D. 83, not 1983.
112
114 None.
115
117 Earlier versions of this standard incorrectly required that the com‐
118 mand:
119
120
121 cal 2000
122
123 write a one-month calendar for the current calendar month (no matter
124 what the current year is) in the year 2000 to standard output. This did
125 not match historic practice in any known version of the cal utility.
126 The description has been updated to match historic practice. When only
127 the year operand is given, cal writes a twelve-month calendar for the
128 specified year.
129
131 A future version of this standard may support locale-specific recogni‐
132 tion of the date of adoption of the Gregorian calendar.
133
135 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
136 Variables
137
139 Portions of this text are reprinted and reproduced in electronic form
140 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
141 table Operating System Interface (POSIX), The Open Group Base Specifi‐
142 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
143 Electrical and Electronics Engineers, Inc and The Open Group. In the
144 event of any discrepancy between this version and the original IEEE and
145 The Open Group Standard, the original IEEE and The Open Group Standard
146 is the referee document. The original Standard can be obtained online
147 at http://www.opengroup.org/unix/online.html .
148
149 Any typographical or formatting errors that appear in this page are
150 most likely to have been introduced during the conversion of the source
151 files to man page format. To report such errors, see https://www.ker‐
152 nel.org/doc/man-pages/reporting_bugs.html .
153
154
155
156IEEE/The Open Group 2017 CAL(1P)