MESG(1)                    POSIX Programmer's Manual                   MESG(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       mesg -- permit or deny messages

SSYYNNOOPPSSIISS
       mesg [[y|n]]

DDEESSCCRRIIPPTTIIOONN
       The _m_e_s_g utility shall control whether other users are allowed to send
       messages via _w_r_i_t_e, _t_a_l_k, or other utilities to a terminal device. The
       terminal device affected shall be determined by searching for the first
       terminal in the sequence of devices associated with standard input,
       standard output, and standard error, respectively. With no arguments,
       _m_e_s_g shall report the current state without changing it. Processes with
       appropriate privileges may be able to send messages to the terminal
       independent of the current state.

OOPPTTIIOONNSS
       None.

OOPPEERRAANNDDSS
       The following operands shall be supported in the POSIX locale:

       _y         Grant permission to other users to send messages to the
                 terminal device.

       _n         Deny permission to other users to send messages to the
                 terminal device.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       The following environment variables shall affect the execution of _m_e_s_g:

       _L_A_N_G      Provide a default value for the internationalization
                 variables that are unset or null. (See the Base Definitions
                 volume of POSIX.1-2008, _S_e_c_t_i_o_n _8_._2, _I_n_t_e_r_n_a_t_i_o_n_a_l_i_z_a_t_i_o_n
                 _V_a_r_i_a_b_l_e_s for the precedence of internationalization
                 variables used to determine the values of locale categories.)

       _L_C___A_L_L    If set to a non-empty string value, override the values of
                 all the other internationalization variables.

       _L_C___C_T_Y_P_E  Determine the locale for the interpretation of sequences of
                 bytes of text data as characters (for example, single-byte as
                 opposed to multi-byte characters in arguments).

       _L_C___M_E_S_S_A_G_E_S
                 Determine the locale that should be used to affect the format
                 and contents of diagnostic messages written (by _m_e_s_g) to
                 standard error.

       _N_L_S_P_A_T_H   Determine the location of message catalogs for the processing
                 of _L_C___M_E_S_S_A_G_E_S.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       If no operand is specified, _m_e_s_g shall display the current terminal
       state in an unspecified format.

SSTTDDEERRRR
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       The following exit values shall be returned:

        0    Receiving messages is allowed.

        1    Receiving messages is not allowed.

       >1    An error occurred.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The mechanism by which the message status of the terminal is changed is
       unspecified. Therefore, unspecified actions may cause the status of the
       terminal to change after _m_e_s_g has successfully completed. These actions
       may include, but are not limited to: another invocation of the _m_e_s_g
       utility, login procedures; invocation of the _s_t_t_y utility, invocation
       of the _c_h_m_o_d utility or _c_h_m_o_d() function, and so on.

EEXXAAMMPPLLEESS
       None.

RRAATTIIOONNAALLEE
       The terminal changed by _m_e_s_g is that associated with the standard
       input, output, or error, rather than the controlling terminal for the
       session. This is because users logged in more than once should be able
       to change any of their login terminals without having to stop the job
       running in those sessions.  This is not a security problem involving
       the terminals of other users because appropriate privileges would be
       required to affect the terminal of another user.

       The method of checking each of the first three file descriptors in
       sequence until a terminal is found was adopted from System V.

       The file //ddeevv//ttttyy is not specified for the terminal device because it
       was thought to be too restrictive. Typical environment changes for the
       _n operand are that write permissions are removed for _o_t_h_e_r_s and _g_r_o_u_p
       from the appropriate device. It was decided to leave the actual
       description of what is done as unspecified because of potential
       differences between implementations.

       The format for standard output is unspecified because of differences
       between historical implementations. This output is generally not useful
       to shell scripts (they can use the exit status), so exact parsing of
       the output is unnecessary.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _t_a_l_k, _w_r_i_t_e

       The Base Definitions volume of POSIX.1-2008, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                              MESG(1)
