NAME
	  write	- Sends	messages to other users

     SYNOPSIS
	  write	[-r] [-n node] user [line]

	  write	user@node [line]

	  write	-h handle,reply

	  write	-q [-n node]


	  The write command allows you to converse with	another	user
	  who is logged	in.  write -r is used to send messages to
	  users	on other hosts (usually	from a shell script) and to
	  wait for replies; use	write -h to reply to such messages.

     FLAGS
	  Note that writeserver	must be	running	for the	-h, -r,	and -q
	  features to work.


	  -h handle,reply
	      Replies to a message sent	by a utility or	shell script
	      with write -r.  The value	to be used for handle is gen-
	      erated internally	and supplied to	you in the text	of the
	      original message.	 The reply can be ok, cancel, or
	      query.  (See EXAMPLES and	EXIT VALUES.)

	  -n node
	      Specifies	a remote host.	The node field may be a	nick-
	      name or a	node ID.

	  -q  Queries all messages awaiting replies from users on a
	      node and displays	them with their	handles.

	  -r  Generates	a message handle, places it in the message
	      header, sends the	message, and waits for a reply.	 This
	      flag can be used for operator messages and can be	put in
	      shell scripts.  It is not	used for interactive conversa-
	      tions.  (See EXAMPLES and	EXIT VALUES).


     DESCRIPTION
	  When two users converse with write, each user	alternately
	  sends	and receives short messages from the other terminal.

	  For another user to receive your message, that user must be
	  logged in and	must not have refused message permission.
	  When a person	you are	trying to reach	is not logged in, you
	  get the message user is not logged on.  When the person you
	  are trying to	reach has refused message permission, you get
	  the message Write: Permission	denied.

	  When you run the write command, it immediately sends the
	  following message, along with	an attention-getting sound
	  (three ASCII BEL characters) to the person whose login name
	  you entered.

	  Message from sender on node (ttynn) [date]...



	  After	successful connection, write then sends	two ASCII BEL
	  characters to	your terminal to alert you that	whatever you
	  enter	now is being sent to the other user.  Sending contin-
	  ues until you	enter the End-of-File key sequence, at which
	  point	write sends an End-of-Text sequence to the other ter-
	  minal	and exits.

	  At any point,	the other user can respond by sending a	write
	  message back.	 For this type of exchange, the	following con-
	  vention is useful.  When you first write to others, wait for
	  them to write	back before sending any	text.  End a message
	  with a prearranged signal (such as o for over) to alert the
	  other	user to	reply.

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

	  When you use the write command to contact a user logged in
	  at more than one terminal, write uses	the first login
	  instance found in the	/var/adm/utmp file as the message
	  delivery point, and you get the message:

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



	  You can contact this user at another location	by specifying
	  the line.  line indicates to which terminal (tty00, for
	  example) the message should be sent.

	  Permission to	use the	write command to contact another user
	  is granted or	denied by the other user with the mesg com-
	  mand.	 Some commands deny message permission while they are
	  running to prevent interference with their output.

	  If you have superuser	authority, you can write to any
	  terminal regardless of the terminal's	message	permission.

	  The write command filters nonprintable characters and
	  transmits them in their printed form (that is, ASCII
	  sequence 001 is transmitted as ^A).

	  When the write -r command is used to send you	a message, you
	  can send a reply of ok, cancel, or query with	write -h.
	  (See FLAGS, EXAMPLES and EXIT	VALUES).

	  An argument of a - (dash) following the write	command	allows
	  you to specify a specific tty	to which you want to write as
	  the second argument.

     EXAMPLES
	  The following	examples assume	that the End-of-File key
	  sequence is <Ctrl-d>.	 The actual key	sequence may be	dif-
	  ferent.


	   1.  lucy on tty3 writes a message to	sue on the same	node:

	       write sue
	       Meet me in the computer room at 12:30.
	       <Ctrl-d>



	       sue sees:

	       Message from lucy on node (tty3)	[Thu Aug 17 11:55:24 1990]
	       Meet me in the computer room at 12:30.
	       <EOT>



	   2.  Holding a conversation:

	       write sue
	       Meet me in the computer room at 12:30.
	       over



	       lucy then waits for a response from sue,	who replies:

	       write lucy
	       I'm running tests at 12:30.  Can	we meet	at 3?
	       over



	       sue then	waits for lucy,	who replies and	terminates:

	       OK--the computer	room at	3.
	       bye
	       <Ctrl-d>



	       sue then	terminates their side of the conversation.

	   3.  To write	someone	a prepared message, enter:

	       write sue <message.text



	       This writes the contents	of the file message.text to
	       sue's terminal.

	   4.  To write	to the person using a certain terminal,	enter:

	       write - console
	       The printer in building 998 has jammed.
	       Please send help.
	       <Ctrl-d>



	       This writes the message to the person logged in on the
	       system console.

	   5.  To send a message to user sue at	node, enter:

	       write -n	node sue



	       or

	       write sue@node



	   6.  To get a	reply to a message, lucy might enter the fol-
	       lowing:

	       write -r	sue console
	       Please insert next tape.



	       sue terminates lucy's message with
	       write -h	12345,ok
	       <Ctrl-d>



	       or

	       write -h	12345,cancel



	       or

	       write -h	12345,query



	       sue then	terminates as usual.

	       Note that with the -h flag, there is no need to supply
	       the hostname or user ID.


     FILES
	  /var/adm/utmp
		     Contains user and accounting information.


     NOTES
	  The writesrv daemon must be running on the target host in
	  order	for any	of the flags to	work.  If you are not using
	  either the -n	flag or	@host, but using -h, -q, or -r,	the
	  writesrv daemon must be running on your host.

     EXIT VALUES
	  The write -r command is used to send messages	to users and
	  to wait for replies.	Their responses	determine the exit
	  value:


	  ok  Exit status 0 (zero).

	  cancel
	      Exit status 1.

	  query
	      Message for handle is redisplayed; write does not	exit.


	  An exit status of 2 indicates	that the user could not	be
	  contacted.

     RELATED INFORMATION
	  Commands:  mesg(1), login(1),	sh(1), talk(1),	wall(1),
	  who(1).

	  Files:  utmp(4).















































Acknowledgement and Disclaimer