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