Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ touch(1) — SunOS 5.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

time(2)

environ(5)

touch(1)

NAME

touch − change file access and modification times

SYNOPSIS

touch [−acm] [−r ref_file] file...
touch [−acm] [−t time] file...
touch [−acm] [date_time] file...

AVAILABILITY

SUNWcsu

DESCRIPTION

The touch utility will change the modification times, the access times, or both, of files. 

The time used can be specified by −t time, by the corresponding time fields of the file referenced by −r ref_file, or by the date_time operand.  If none of these are specified, touch will use the current time (the value returned by the time(2) system call). 

If neither the −a nor −m options were specified, touch will update both the modification and access times. 

OPTIONS

The following options are supported:

−a Change the access time of file. Do not change the modification time unless −m is also specified. 

−c Do not create a specified file if it does not exist.  Do not write any diagnostic messages concerning this condition. 

−m Change the modification time of file. Do not change the access time unless −a is also specified. 

−r ref_file Use the corresponding times of the file named by ref_file instead of the current time. 

−t time Use the specified time instead of the current time.  time will be a decimal number of the form:

[[CC]YY]MMDDhhmm [.SS]

where each two digits represents the following:

MM The month of the year [01-12]. 

DD The day of the month [01-31]. 

hh The hour of the day [00-23]. 

mm The minute of the hour [00-59]. 

CC The first two digits of the year. 

YY The second two digits of the year. 

SS The second of the minute [00-61]. 

Both CC and YY are optional.  If neither is given, the current year will be assumed.  If YY is specified, but CC is not, CC will be derived as follows:

If YY is: CC becomes:
69-99 19
00-38 20
39-68 ERROR

The resulting time will be affected by the value of the TZ environment variable.  If the resulting time value precedes the Epoch, touch will exit immediately with an error status.  The range of valid times is the Epoch to January 18, 2038. 

The range for SS is (00−61) rather than (00−59) because of leap seconds.  If SS is 60 or 61, and the resulting time, as affected by the TZ environment variable, does not refer to a leap second, the resulting time will be one or two seconds after a time where SS is 59.  If SS is not given, it is assumed to be 0. 

OPERANDS

The following operands are supported:

file A path name of a file whose times are to be modified. 

date_time Use the specified date_time instead of the current time.  date_time is a decimal number of the form:

MMDDhhmm[yy]

where MM, DD, hh, and mm are as described for the time option-argument to the −t option and the optional yy is interpreted as follows:

If not specified, the current year will be used.  If yy is in the range 69-99, the corresponding year 1969-1999 will be used; if yy is in the range 00-38, the corresponding year 2000-2038 will be used; if yy is in the range 39-68, an error will result. 

If no −r option is specified, no −t option is specified, at least two operands are specified, and the first operand is an eight- or ten-digit decimal integer, the first operand will be assumed to be a date_time operand; otherwise, the first operand will be assumed to be a file operand. 

RETURN VALUES

touch returns the number of files for which the times could not be successfully modified. 

ENVIRONMENT

See environ(5) for descriptions of the following environment variables that affect the execution of touch: LC_MESSAGES, NLSPATH, and TZ.

EXIT STATUS

The following exit values are returned:

0 touch executed successfully and all requested changes were made. 

>0 An error occurred. 

SEE ALSO

time(2), environ(5)

NOTES

Users familiar with the BSD environment will find that the −f option is accepted, but ignored.  The −f option is unnecessary since touch will succeed for all files owned by the user regardless of the permissions on the files. 

SunOS 5.5  —  Last change: 1 Feb 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026