|HP-UX Reference > W
HP-UX 11i Version 3: February 2007
write — interactively write (talk) to another user
The write command copies lines from your terminal to that of another user. When first called, it sends the message:
to the receiving user's terminal. When it has successfully completed the connection, it also sends two bells to your own terminal to indicate that what you are typing is being sent.
To set up two-way communication, the recipient of the message (user) must execute the command:
write yourname [yourterminal]
(yourterminal is only required if the originator is logged in more than once.)
Communication continues until an end of file is read from the terminal, an interrupt is sent, or the recipient executes mesg n. At that point, write writes <EOT> on the other terminal and exits.
To write to a user who is logged in more than once, use the terminal argument to indicate which line or terminal to send to (e.g., tty00). Otherwise, the first writable instance of the user found in utmps database is assumed and the following message is displayed:
user is logged on more than one place. You are connected to "terminal". Other locations are: terminal ...
Permission to write may be denied or granted with the mesg command (see mesg(1)). Writing to others is normally allowed by default. Certain commands, in particular nroff and pr disallow messages in order to prevent interference with their output. However, if the user has the appropriate privileges, messages can be forced onto a write-inhibited terminal.
If the character ! is found at the beginning of a line, write calls the POSIX shell (see sh-posix(1)) to execute the rest of the line as a command.
The following protocol is suggested for using write: When you first write to another user, wait for the user to write back before starting to send. Each person should end a message with a distinctive signal (such as "(o) " for "over") so that the other person knows when to reply. Similarly, the signal "(oo) " (for "over and out") can be used to indicate the end of the conversation.
LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_) do not specify a locale. If LANG is not set or is set to the empty string, a default of "C" (see lang(5)) is used.
LC_TIME determines the format and contents of date and time strings.
LC_MESSAGES determines the language in which messages are displayed.
If any internationalization variable contains an invalid setting, write behaves as if all internationalization variables are set to "C". See environ(5).
By issuing the command:
user linda sends a message to user matthew's screen. If matthew responds:
two-way communication between matthew and linda is established.