Annotation of src/usr.bin/touch/touch.1, Revision 1.4
1.4 ! aaron 1: .\" $OpenBSD: touch.1,v 1.3 1998/10/30 00:24:40 aaron Exp $
1.1 deraadt 2: .\" $NetBSD: touch.1,v 1.8 1995/08/31 22:10:05 jtc Exp $
3: .\"
4: .\" Copyright (c) 1991, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the University of
21: .\" California, Berkeley and its contributors.
22: .\" 4. Neither the name of the University nor the names of its contributors
23: .\" may be used to endorse or promote products derived from this software
24: .\" without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: .\" SUCH DAMAGE.
37: .\"
38: .\" @(#)touch.1 8.3 (Berkeley) 4/28/95
39: .\"
40: .Dd April 28, 1995
41: .Dt TOUCH 1
42: .Os
43: .Sh NAME
44: .Nm touch
45: .Nd change file access and modification times
46: .Sh SYNOPSIS
47: .Nm touch
48: .Op Fl acfm
49: .Op Fl r Ar file
50: .Op Fl t Ar [[CC]YY]MMDDhhmm[.SS]
1.3 aaron 51: .Ar file Op Ar ...
1.1 deraadt 52: .Sh DESCRIPTION
53: The
54: .Nm touch
55: utility sets the modification and access times of files to the
56: current time of day.
57: If the file doesn't exist, it is created with default permissions.
58: .Pp
1.4 ! aaron 59: The options are as follows:
1.1 deraadt 60: .Bl -tag -width Ds
61: .It Fl a
62: Change the access time of the file.
63: The modification time of the file is not changed unless the
64: .Fl m
65: flag is also specified.
66: .It Fl c
67: Do not create the file if it does not exist.
68: The
69: .Nm touch
70: utility does not treat this as an error.
71: No error messages are displayed and the exit value is not affected.
72: .It Fl f
73: Attempt to force the update, even if the file permissions do not
74: currently permit it.
75: .It Fl m
76: Change the modification time of the file.
77: The access time of the file is not changed unless the
78: .Fl a
79: flag is also specified.
80: .It Fl r
81: Use the access and modifications times from the specified file
82: instead of the current time of day.
83: .It Fl t
84: Change the access and modification times to the specified time.
85: The argument should be in the form
86: .Dq [[CC]YY]MMDDhhmm[.SS]
87: where each pair of letters represents the following:
88: .Pp
89: .Bl -tag -width Ds -compact -offset indent
90: .It Ar CC
91: The first two digits of the year (the century).
92: .It Ar YY
93: The second two digits of the year.
94: If
95: .Dq YY
96: is specified, but
97: .Dq CC
98: is not, a value for
99: .Dq YY
100: between 69 and 99 results in a
101: .Dq CC
102: value of 19.
103: Otherwise, a
104: .Dq CC
105: value of 20 is used.
106: .It Ar MM
107: The month of the year, from 1 to 12.
108: .It Ar DD
1.3 aaron 109: The day of the month, from 1 to 31.
1.1 deraadt 110: .It Ar hh
111: The hour of the day, from 0 to 23.
112: .It Ar mm
113: The minute of the hour, from 0 to 59.
114: .It Ar SS
115: The second of the minute, from 0 to 61.
116: .El
117: .Pp
118: If the
119: .Dq CC
120: and
121: .Dq YY
122: letter pairs are not specified, the values default to the current
123: year.
124: If the
125: .Dq SS
126: letter pair is not specified, the value defaults to 0.
127: .El
128: .Pp
129: The
130: .Nm touch
1.3 aaron 131: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 132: .Sh SEE ALSO
133: .Xr utimes 2
134: .Sh COMPATIBILITY
135: The obsolescent form of
136: .Nm touch ,
137: where a time format is specified as the first argument, is supported.
138: When no
139: .Fl r
140: or
141: .Fl t
142: option is specified, there are at least two arguments, and the first
143: argument is a string of digits either eight or ten characters in length,
144: the first argument is interpreted as a time specification of the form
145: .Dq MMDDhhmm[YY] .
146: .Pp
147: The
148: .Dq MM ,
149: .Dq DD ,
150: .Dq hh
151: and
152: .Dq mm
153: letter pairs are treated as their counterparts specified to the
154: .Fl t
155: option.
156: If the
157: .Dq YY
158: letter pair is in the range 69 to 99, the year is set to 1969 to 1999,
159: otherwise, the year is set in the 21st century.
160: .Sh HISTORY
161: A
162: .Nm touch
163: utility appeared in
164: .At v7 .
165: .Sh STANDARDS
166: The
167: .Nm touch
168: utility is expected to be a superset of the
169: .St -p1003.2
170: specification.