Message from login on system-name (terminal) [date] . . .
If the POSIX2 variable is set to any value and exported in the current process environment, then the message sent omits the system-name:
Message from login (terminal) [date] . . .
When it has successfully completed the connection, write also sends two bells to your own terminal to indicate that what you are typing is being sent.
The recipient of the message may write back at this point.
Communication continues until an end of file is read from the
terminal, an interrupt is sent, or the recipient has executed
``mesg n.''
At that point write
writes EOT
on the other terminal and exits.
If you want to write to a user who is logged in more than once, use the terminal argument to indicate the terminal to which you want to write (for example, term/12); otherwise, the first writable instance of the user found in /var/adm/utmp is assumed and the following message posted:
user is logged on more than one place. You are connected to ``terminal.'' Other locations are: other_terminal
Permission to write may be denied or granted by use of the mesg command. Writing to others is normally allowed by default. Certain commands, such as the pr command, disallow messages in order to prevent interference with their output. However, if the user has appropriate privilege, messages can be forced onto a write-inhibited terminal.
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 user's terminals.
write processes supplementary code set characters according to the locale specified in the LC_CTYPE environment variable (see LANG on environ(5)). It will detect non-printable characters before sending them to the user's terminal. Control characters will appear as a caret (`^') followed by the appropriate ASCII character; characters with the high-order bit set will appear in \(lqmeta\(rq notation. For example, `\003' is displayed as `^C' and `\372' as `M-z'.
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 user should end a message with a distinctive signal (that is, ``(o)'' for ``over'') so that the other user knows when to reply. The signal ``(oo)'' (for ``over and out'') is suggested when conversation is to be terminated.
UX:write:ERROR:User is not logged on.
UX:write:ERROR:Permission denied.
UX:write:Warning: cannot respond, set mesg -y.
UX:write:ERROR:Can no longer write to user.