DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

write(1)


write -- write to another user

Synopsis

write user [terminal]

Description

write copies lines from your terminal to that of another user. Initially, it sends the following message to the other user:
   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.

Files


/var/adm/utmp to find user

/usr/bin/sh to execute a shell escape (!)

/usr/lib/locale/locale/LC_MESSAGES/uxcore
language-specific message file (see LANG on environ(5)).

Errors


UX:write:ERROR:User is not logged on.
if the user you are trying to write to is not logged on.

UX:write:ERROR:Permission denied.
if the user you are trying to write to denies that permission (with mesg).

UX:write:Warning: cannot respond, set mesg -y.
if your terminal is set to mesg n and the recipient cannot respond to you.

UX:write:ERROR:Can no longer write to user.
if the recipient has denied permission (mesg n) after you had started writing.

Compatibility Notes

The write commands behaves differently depending on whether the variable POSIX2 is set to a value and exported in the current process environment, as follows:

References

mail(1), mesg(1), pr(1), setuid(2), sh(1), who(1)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004