DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

write(C)


write -- write to another user

Syntax

write user [ tty ]

Description

The write command copies lines from your terminal to that of another user. When first called, it sends the message:
   Message from your-logname your-tty ...
The recipient of the message should write back at this point. Communication continues until an end-of-file is read from the terminal or an interrupt is sent. At that point, write displays the following on the other terminal and exits:
   (end of message)
If you want to write to a user who is logged in more than once, the tty argument may be used to indicate the appropriate terminal.

Permission to receive messages from other users of the system may be granted or denied by use of the mesg(C) command. By default, users are not allowed to receive messages (this is for security). This may be altered by issuing the mesg command from the .login script.

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. Output from the command is sent to the terminal; it is not sent to the remote user.

The following protocol is suggested for using write: when you first write to another user, wait for him or her to write back before starting to send. Each party should end each message with a distinctive signal ((o) for ``over'' is conventional), indicating that the other may reply; (oo) for ``over and out'' is suggested when conversation is to be terminated.

Return values

A return value of 0 indicates successful completion; a value of 1 indicates that an error occurred.

Authorization

The behavior of this utility is affected by assignment of the terminal authorization in authorize(F). Refer to subsystem(M) for more details.

Examples

write john

Contacts user ``john''.

write john tty07

Contacts user ``john'' via tty07.

Files


/etc/utmp
to find user

/bin/sh
to execute ``!''

See also

hello(C), mail(C), mesg(C), who(C)

Standards conformance

write is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003