xref: /illumos-gate/usr/src/man/man1/write.1 (revision a69e76ca280a5227e229566b1e076da8f32193e0)

Sun Microsystems, Inc. gratefully acknowledges The Open Group for
permission to reproduce portions of its copyrighted documentation.
Original documentation from The Open Group can be obtained online at
http://www.opengroup.org/bookstore/.

The Institute of Electrical and Electronics Engineers and The Open
Group, have given us permission to reprint portions of their
documentation.

In the following statement, the phrase ``this text'' refers to portions
of the system documentation.

Portions of this text are reprinted and reproduced in electronic form
in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
Standard for Information Technology -- Portable Operating System
Interface (POSIX), The Open Group Base Specifications Issue 6,
Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
Engineers, Inc and The Open Group. In the event of any discrepancy
between these versions and the original IEEE and The Open Group
Standard, the original IEEE and The Open Group Standard is the referee
document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html.

This notice shall appear on any product containing this material.

The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.

You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.

When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]


Copyright 1989 AT&T
Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
Copyright (c) 2000, Sun Microsystems, Inc. All Rights Reserved

WRITE 1 "Nov 3, 2000"
NAME
write - write to another user
SYNOPSIS

write user [terminal]
DESCRIPTION

The write utility reads lines from the user's standard input and writes them to the terminal of another user. When first invoked, it writes the message:

Message from sender-login-id (sending-terminal) [date]...

to user. When it has successfully completed the connection, the sender's terminal will be alerted twice to indicate that what the sender is typing is being written to the recipient's terminal.

If the recipient wants to reply, this can be accomplished by typing

write sender-login-id [sending-terminal]

upon receipt of the initial message. Whenever a line of input as delimited by a NL, EOF, or EOL special character is accumulated while in canonical input mode, the accumulated data will be written on the other user's terminal. Characters are processed as follows:

Typing the alert character will write the alert character to the recipient's terminal.

Typing the erase and kill characters will affect the sender's terminal in the manner described by the termios(3C) interface.

Typing the interrupt or end-of-file characters will cause write to write an appropriate message (EOT\en in the C locale) to the recipient's terminal and exit.

Typing characters from LC_CTYPE classifications print or space will cause those characters to be sent to the recipient's terminal.

When and only when the stty iexten local mode is enabled, additional special control characters and multi-byte or single-byte characters are processed as printable characters if their wide character equivalents are printable.

Typing other non-printable characters will cause them to be written to the recipient's terminal as follows: control characters will appear as a `^' followed by the appropriate ASCII character, and characters with the high-order bit set will appear in "meta" notation. For example, `\e003' is displayed as `^C' and `\e372' as `M-z'.

To write to a user who is logged in more than once, the terminal argument can be used to indicate which terminal to write to. Otherwise, the recipient's terminal is the first writable instance of the user found in /usr/adm/utmpx, and the following informational message will be written to the sender's standard output, indicating which terminal was chosen:

user is logged on more than one place.
You are connected to terminal.
Other locations are:terminal

Permission to be a recipient of a write message can be denied or granted by use of the mesg utility. However, a user's privilege may further constrain the domain of accessibility of other users' terminals. The write utility will fail when the user lacks the appropriate privileges to perform the requested action.

If the character ! is found at the beginning of a line, write calls the shell to execute the rest of the line as a command.

write runs setgid() (see setuid(2)) to the group ID tty, in order to have write permissions on other users' terminals.

The following protocol is suggested for using write: when you first write to another user, wait for them to write back before starting to send. Each person should end a message with a distinctive signal (that is, (o) for over) so that the other person knows when to reply. The signal (oo) (for over and out) is suggested when conversation is to be terminated.

OPERANDS

The following operands are supported: user

User (login) name of the person to whom the message will be written. This operand must be of the form returned by the who(1) utility.

terminal

Terminal identification in the same format provided by the who utility.

ENVIRONMENT VARIABLES

See environ(5) for descriptions of the following environment variables that affect the execution of write: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.

EXIT STATUS

The following exit values are returned: 0

Successful completion.

>0

The addressed user is not logged on or the addressed user denies permission.

FILES
/var/adm/utmpx

User and accounting information for write

/usr/bin/sh

Bourne shell executable file

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
CSI Enabled
Interface Stability Committed
Standard See standards(5).
SEE ALSO

mail(1), mesg(1), pr(1), sh(1), talk(1), who(1), setuid(2), termios(3C), attributes(5), environ(5), standards(5)

DIAGNOSTICS
user is not logged on

The person you are trying to write to is not logged on.

Permission denied

The person you are trying to write to denies that permission (with mesg).

Warning: cannot respond, set mesg-y

Your terminal is set to mesg n and the recipient cannot respond to you.

Can no longer write to user

The recipient has denied permission (mesg n) after you had started writing.