Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
mailx.html (106257B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>mailx</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/m4.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/make.html" accesskey="N">Next >>></a></td> 19 </tr> 20 </table> 21 <hr align="left" width="100%"></div> 22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 23 <center><font size="2">The Open Group Base Specifications Issue 8<br> 24 IEEE Std 1003.1-2024<br> 25 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 26 <hr size="2" noshade> 27 <a name="top" id="top"></a> <a name="mailx" id="mailx"></a> <a name="tag_20_75" id="tag_20_75"></a><!-- mailx --> 28 <h4 class="mansect"><a name="tag_20_75_01" id="tag_20_75_01"></a>NAME</h4> 29 <blockquote>mailx — process messages</blockquote> 30 <h4 class="mansect"><a name="tag_20_75_02" id="tag_20_75_02"></a>SYNOPSIS</h4> 31 <blockquote class="synopsis"> 32 <h5><a name="tag_20_75_02_01" id="tag_20_75_02_01"></a>Send Mode</h5> 33 <p><code><tt>mailx</tt> <b>[</b><tt>-E</tt><b>] [</b><tt>-s</tt> <i>subject</i><b>]</b> <i>address</i><tt>...</tt></code></p> 34 <h5><a name="tag_20_75_02_02" id="tag_20_75_02_02"></a>Receive Mode</h5> 35 <pre> 36 <tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup><img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 37 mailx -e 38 mailx </tt><b>[</b><tt>-HiNn</tt><b>] [</b><tt>-F</tt><b>] [</b><tt>-u </tt><i>user</i><b>]</b><tt> 39 mailx -f </tt><b>[</b><tt>-HiNn</tt><b>] [</b><tt>-F</tt><b>] [</b><i>file</i><b>]</b><tt> 40 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 41 </tt></pre></blockquote> 42 <h4 class="mansect"><a name="tag_20_75_03" id="tag_20_75_03"></a>DESCRIPTION</h4> 43 <blockquote> 44 <p>The <i>mailx</i> utility provides a message sending and receiving facility. It has two major modes, selected by the options 45 used: Send Mode and Receive Mode.</p> 46 <p>On systems that do not support the User Portability Utilities option, an application using <i>mailx</i> shall have the ability 47 to send messages in an unspecified manner (Send Mode). Unless the first character of one or more lines is <tilde> 48 (<tt>'~'</tt>), all characters in the input message shall appear in the delivered message, but additional characters may be 49 inserted in the message before it is retrieved.</p> 50 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> On 51 systems supporting the User Portability Utilities option, mail-receiving capabilities and other interactive features, Receive Mode, 52 described below, also shall be enabled. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 53 <h5><a name="tag_20_75_03_01" id="tag_20_75_03_01"></a>Send Mode</h5> 54 <p>Send Mode can be used by applications or users to send messages from the text in standard input. The message shall be passed to 55 the mail delivery software. The mail delivery software shall process passed messages according to the rules of IETF RFC 5322.</p> 56 <h5><a name="tag_20_75_03_02" id="tag_20_75_03_02"></a>Receive Mode</h5> 57 <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 58 <p>Receive Mode is more oriented towards interactive users. Mail can be read and sent in this interactive mode.</p> 59 <p>When reading mail, <i>mailx</i> provides commands to facilitate saving, deleting, and responding to messages. When sending mail, 60 <i>mailx</i> allows editing, reviewing, and other modification of the message as it is entered.</p> 61 <p>Incoming mail shall be stored in one or more unspecified locations for each user, collectively called the system <i>mailbox</i> 62 for that user. When <i>mailx</i> is invoked in Receive Mode, the system mailbox shall be the default place to find new mail. As 63 messages are read, they shall be marked to be moved to a secondary file for storage, unless specific action is taken. This 64 secondary file is called the <b>mbox</b> and is normally located in the directory referred to by the <i>HOME</i> environment 65 variable (see <i>MBOX</i> in the ENVIRONMENT VARIABLES section for a description of this file). Messages shall remain in this file 66 until explicitly removed. When the <b>-f</b> option is used to read mail messages from secondary files, messages shall be retained 67 in those files unless specifically removed. All three of these locations—system mailbox, <b>mbox</b>, and secondary file—are 68 referred to in this section as simply "mailboxes", unless more specific identification is required. <img src= 69 "../images/opt-end.gif" alt="[Option End]" border="0"></p> 70 </blockquote> 71 <h4 class="mansect"><a name="tag_20_75_04" id="tag_20_75_04"></a>OPTIONS</h4> 72 <blockquote> 73 <p>The <i>mailx</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 74 Guidelines</i></a> .</p> 75 <p>The following options shall be supported. (Only the <b>-E</b> and <b>-s</b> <i>subject</i> options are required on all systems. 76 The other options are required only on systems supporting the User Portability Utilities option.)</p> 77 <dl compact> 78 <dd></dd> 79 <dt><b>-E</b></dt> 80 <dd>Discard messages with an empty message body.</dd> 81 <dt><b>-e</b></dt> 82 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 83 Test for the presence of mail in the system mailbox. The <i>mailx</i> utility shall write nothing and exit with a successful return 84 code if there is mail to read. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 85 <dt><b>-f</b></dt> 86 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 87 Read messages from the file named by the <i>file</i> operand instead of the system mailbox. (See also <b>folder</b>.) If no 88 <i>file</i> operand is specified, read messages from <b>mbox</b> instead of the system mailbox. <img src="../images/opt-end.gif" 89 alt="[Option End]" border="0"></dd> 90 <dt><b>-F</b></dt> 91 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 92 Record the message in a file named after the first recipient. The name is the login-name portion of the address found first in the 93 <b>To</b> field in the message header. Overrides the <b>record</b> variable, if set (see <a href="#tag_20_75_13_02">Internal 94 Variables in mailx</a> ). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 95 <dt><b>-H</b></dt> 96 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 97 Write a header summary only. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 98 <dt><b>-i</b></dt> 99 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 100 Ignore interrupts. (See also <b>ignore</b>.) <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 101 <dt><b>-n</b></dt> 102 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Do 103 not initialize from the system default start-up file. See the EXTENDED DESCRIPTION section. <img src="../images/opt-end.gif" alt= 104 "[Option End]" border="0"></dd> 105 <dt><b>-N</b></dt> 106 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Do 107 not write an initial header summary. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 108 <dt><b>-s </b><i>subject</i></dt> 109 <dd>Set the <b>Subject</b> header field to <i>subject</i>. All characters in the <i>subject</i> string shall appear in the 110 delivered message. The results are unspecified if <i>subject</i> is longer than {LINE_MAX} - 10 bytes or contains a 111 <newline>.</dd> 112 <dt><b>-u </b><i>user</i></dt> 113 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 114 Read the system mailbox of the login name <i>user</i>. This shall only be successful if the invoking user has appropriate 115 privileges to read the system mailbox of that user. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 116 </dl> 117 </blockquote> 118 <h4 class="mansect"><a name="tag_20_75_05" id="tag_20_75_05"></a>OPERANDS</h4> 119 <blockquote> 120 <p>The following operands shall be supported:</p> 121 <dl compact> 122 <dd></dd> 123 <dt><i>address</i></dt> 124 <dd>Addressee of message. When <b>-n</b> is specified and no user start-up files are accessed (see the EXTENDED DESCRIPTION 125 section), the user or application shall ensure this is an address to pass to the mail delivery system. Any system or user start-up 126 files may enable aliases (see <b>alias</b> under <a href="#tag_20_75_13_03">Commands in mailx</a> ) that may modify the form of 127 <i>address</i> before it is passed to the mail delivery system.</dd> 128 <dt><i>file</i></dt> 129 <dd><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> A 130 pathname of a file to be read instead of the system mailbox when <b>-f</b> is specified. The meaning of the <i>file</i> operand 131 shall be affected by the contents of the <b>folder</b> internal variable; see <a href="#tag_20_75_13_02">Internal Variables in 132 mailx</a> . <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 133 </dl> 134 </blockquote> 135 <h4 class="mansect"><a name="tag_20_75_06" id="tag_20_75_06"></a>STDIN</h4> 136 <blockquote> 137 <p>When <i>mailx</i> is invoked in Send Mode (the first synopsis line), standard input shall be the message to be delivered to the 138 specified addresses. <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt= 139 "[Option Start]" border="0"> When in Receive Mode, user commands shall be accepted from <i>stdin</i>. <img src= 140 "../images/opt-end.gif" alt="[Option End]" border="0"> If the User Portability Utilities option is not supported, standard 141 input lines beginning with a <tilde> (<tt>'~'</tt>) character produce unspecified results.</p> 142 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If 143 the User Portability Utilities option is supported, then in both Send and Receive Modes, standard input lines beginning with the 144 escape character (usually <tilde> (<tt>'~'</tt>)) shall affect processing as described in <a href="#tag_20_75_13_48">Command 145 Escapes in mailx</a> . <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 146 </blockquote> 147 <h4 class="mansect"><a name="tag_20_75_07" id="tag_20_75_07"></a>INPUT FILES</h4> 148 <blockquote> 149 <p>When <i>mailx</i> is used as described by this volume of POSIX.1-2024, the <i>file</i> operand (see the <b>-f</b> option) and 150 the <b>mbox</b> shall be text files containing mail messages, formatted as described in the OUTPUT FILES section. The nature of the 151 system mailbox is unspecified; it need not be a file.</p> 152 </blockquote> 153 <h4 class="mansect"><a name="tag_20_75_08" id="tag_20_75_08"></a>ENVIRONMENT VARIABLES</h4> 154 <blockquote> 155 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 156 Some of the functionality described in this section shall be provided on implementations that support the User Portability 157 Utilities option as described in the text, and is not further shaded for this option. <img src="../images/opt-end.gif" alt= 158 "[Option End]" border="0"></p> 159 <p>The following environment variables shall affect the execution of <i>mailx</i>:</p> 160 <dl compact> 161 <dd></dd> 162 <dt><i>DEAD</i></dt> 163 <dd>Determine the pathname of the file in which to save partial messages in case of interrupts or delivery errors. The default 164 shall be <b>dead.letter</b> in the directory named by the <i>HOME</i> variable. The behavior of <i>mailx</i> in saving partial 165 messages is unspecified if the User Portability Utilities option is not supported and <i>DEAD</i> is not defined with the value 166 <b>/dev/null</b>.</dd> 167 <dt><i>EDITOR</i></dt> 168 <dd>Determine the name of a utility to invoke when the <b>edit</b> (see <a href="#tag_20_75_13_03">Commands in mailx</a> ) or 169 <b>~e</b> (see <a href="#tag_20_75_13_48">Command Escapes in mailx</a> ) command is used. The default editor is unspecified. 170 <sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 171 On XSI-conformant systems it is <a href="../utilities/ed.html"><i>ed</i></a>. <img src="../images/opt-end.gif" alt= 172 "[Option End]" border="0"> The effects of this variable are unspecified if the User Portability Utilities option is not 173 supported.</dd> 174 <dt><i>HOME</i></dt> 175 <dd>Determine the pathname of the user's home directory.</dd> 176 <dt><i>LANG</i></dt> 177 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 178 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization 179 variables used to determine the values of locale categories.)</dd> 180 <dt><i>LC_ALL</i></dt> 181 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 182 <dt><i>LC_CTYPE</i></dt> 183 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 184 opposed to multi-byte characters in arguments and input files) and the handling of case-insensitive address and header field name 185 comparisons.</dd> 186 <dt><i>LC_TIME</i></dt> 187 <dd>This variable may determine the format and contents of the date and time strings written by <i>mailx</i>. This volume of 188 POSIX.1-2024 specifies the effects of this variable only for systems supporting the User Portability Utilities option.</dd> 189 <dt><i>LC_MESSAGES</i></dt> 190 <dd><br> 191 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and 192 informative messages written to standard output.</dd> 193 <dt><i>LISTER</i></dt> 194 <dd>Determine a string representing the command for writing the contents of the <b>folder</b> directory to standard output when the 195 <b>folders</b> command is given (see <b>folders</b> in <a href="#tag_20_75_13_03">Commands in mailx</a> ). Any string acceptable as 196 a <i>command_string</i> operand to the <a href="../utilities/sh.html"><i>sh</i></a> <b>-c</b> command shall be valid. If this 197 variable is null or not set, the output command shall be <a href="../utilities/ls.html"><i>ls</i></a>. The effects of this variable 198 are unspecified if the User Portability Utilities option is not supported.</dd> 199 <dt><i>MAILRC</i></dt> 200 <dd>Determine the pathname of the user start-up file. The default shall be <b>.mailrc</b> in the directory referred to by the 201 <i>HOME</i> environment variable. The behavior of <i>mailx</i> is unspecified if the User Portability Utilities option is not 202 supported and <i>MAILRC</i> is not defined with the value <b>/dev/null</b>.</dd> 203 <dt><i>MBOX</i></dt> 204 <dd>Determine a pathname of the file to save messages from the system mailbox that have been read. The <b>exit</b> command shall 205 override this function, as shall saving the message explicitly in another file. The default shall be <b>mbox</b> in the directory 206 named by the <i>HOME</i> variable. The effects of this variable are unspecified if the User Portability Utilities option is not 207 supported.</dd> 208 <dt><i>NLSPATH</i></dt> 209 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 210 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 211 "0"></dd> 212 <dt><i>PAGER</i></dt> 213 <dd>Determine a string representing an output filtering or pagination command for writing the output to the terminal. Any string 214 acceptable as a <i>command_string</i> operand to the <a href="../utilities/sh.html"><i>sh</i></a> <b>-c</b> command shall be valid. 215 When standard output is a terminal device, the message output shall be piped through the command if the <i>mailx</i> internal 216 variable <b>crt</b> is set to a value less than the total number of lines in the message; see <a href="#tag_20_75_13_02">Internal 217 Variables in mailx</a> . When standard output is not a terminal device, it is unspecified whether the message output is written 218 directly to standard output or is subject to pagination. If the <i>PAGER</i> variable is null or not set, the paginator shall be 219 either <a href="../utilities/more.html"><i>more</i></a> or another paginator utility documented in the system documentation. The 220 effects of this variable are unspecified if the User Portability Utilities option is not supported.</dd> 221 <dt><i>SHELL</i></dt> 222 <dd>Determine the name of a preferred command interpreter. The default shall be <a href="../utilities/sh.html"><i>sh</i></a>. The 223 effects of this variable are unspecified if the User Portability Utilities option is not supported.</dd> 224 <dt><i>TERM</i></dt> 225 <dd>If the internal variable <b>screen</b> is not specified, determine the name of the terminal type to indicate in an unspecified 226 manner the number of lines in a screenful of header summaries. If <i>TERM</i> is not set or is set to null, an unspecified default 227 terminal type shall be used and the value of a screenful is unspecified. The effects of this variable are unspecified if the User 228 Portability Utilities option is not supported.</dd> 229 <dt><i>TZ</i></dt> 230 <dd>This variable may determine the timezone used to calculate date and time strings written by <i>mailx</i>. If <i>TZ</i> is unset 231 or null, an unspecified default timezone shall be used.</dd> 232 <dt><i>VISUAL</i></dt> 233 <dd>Determine a pathname of a utility to invoke when the <b>visual</b> command (see <a href="#tag_20_75_13_03">Commands in 234 mailx</a> ) or <b>~v</b> command-escape (see <a href="#tag_20_75_13_48">Command Escapes in mailx</a> ) is used. If this variable is 235 null or not set, the full-screen editor shall be <a href="../utilities/vi.html"><i>vi</i></a>. The effects of this variable are 236 unspecified if the User Portability Utilities option is not supported.</dd> 237 </dl> 238 </blockquote> 239 <h4 class="mansect"><a name="tag_20_75_09" id="tag_20_75_09"></a>ASYNCHRONOUS EVENTS</h4> 240 <blockquote> 241 <p>When <i>mailx</i> is in Send Mode and standard input is not a terminal, it shall take the standard action for all signals.</p> 242 <p>In <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 243 Receive Mode, or in <img src="../images/opt-end.gif" alt="[Option End]" border="0"> Send Mode when standard input is a 244 terminal, if a SIGINT signal is received:</p> 245 <ol> 246 <li> 247 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If 248 in command mode, the current command, if there is one, shall be aborted, and a command-mode prompt shall be written. <img src= 249 "../images/opt-end.gif" alt="[Option End]" border="0"></p> 250 </li> 251 <li> 252 <p>If in input mode:</p> 253 <ol type="a"> 254 <li> 255 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If 256 <b>ignore</b> is set, <i>mailx</i> shall write <tt>"@\n"</tt>, discard the current input line, and continue processing, bypassing 257 the message-abort mechanism described in item 2b. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p> 258 </li> 259 <li> 260 <p>If the interrupt was received while sending mail, either when in <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> 261 <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Receive Mode or in <img src="../images/opt-end.gif" alt= 262 "[Option End]" border="0"> Send Mode, a message shall be written, and another subsequent interrupt, with no other intervening 263 characters typed, shall be required to abort the mail message. <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src= 264 "../images/opt-start.gif" alt="[Option Start]" border="0"> If in Receive Mode and another interrupt is received, a 265 command-mode prompt shall be written. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> If in Send Mode and 266 another interrupt is received, <i>mailx</i> shall terminate with a non-zero status.</p> 267 <p>In both cases listed in item b, if the message is not empty:</p> 268 <ol type="i"> 269 <li> 270 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If 271 <b>save</b> is enabled and the file named by <i>DEAD</i> can be created, the message shall be written to the file named by <i>DEAD 272 .</i> If the file exists, the message shall be written to replace the contents of the file. <img src="../images/opt-end.gif" alt= 273 "[Option End]" border="0"></p> 274 </li> 275 <li> 276 <p>If <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 277 <b>save</b> is not enabled, or <img src="../images/opt-end.gif" alt="[Option End]" border="0"> the file named by <i>DEAD</i> 278 cannot be created, the message shall not be saved.</p> 279 </li> 280 </ol> 281 </li> 282 </ol> 283 </li> 284 </ol> 285 <p>The <i>mailx</i> utility shall take the standard action for all other signals.</p> 286 </blockquote> 287 <h4 class="mansect"><a name="tag_20_75_10" id="tag_20_75_10"></a>STDOUT</h4> 288 <blockquote> 289 <p>In command and input modes, all output, including prompts and messages, shall be written to standard output.</p> 290 </blockquote> 291 <h4 class="mansect"><a name="tag_20_75_11" id="tag_20_75_11"></a>STDERR</h4> 292 <blockquote> 293 <p>The standard error shall be used only for diagnostic messages.</p> 294 </blockquote> 295 <h4 class="mansect"><a name="tag_20_75_12" id="tag_20_75_12"></a>OUTPUT FILES</h4> 296 <blockquote> 297 <p>Various <i>mailx</i> commands and command escapes can create or add to files, including the <b>mbox</b>, the dead-letter file, 298 and secondary mailboxes. When <i>mailx</i> is used as described in this volume of POSIX.1-2024, these files shall be text files, 299 formatted as follows:</p> 300 <blockquote><tt>line beginning with</tt> <b>From<space><br> 301 [</b><tt>one or more</tt> <i>header fields</i>; see <a href="#tag_20_75_13_03">Commands in mailx</a> ]<br> 302 <i>empty line<br></i> <b>[</b><tt>zero or more</tt> <i>body lines<br> 303 empty line]<br></i> <b>[</b><tt>line beginning with</tt> <b>From<space>...]</b></blockquote> 304 <p>where each message begins with the <b>From <space></b> line shown, preceded by the beginning of the file or an empty 305 line. (The <b>From <space></b> line is considered to be part of the message header, but not one of the header fields referred 306 to in <a href="#tag_20_75_13_03">Commands in mailx</a> ; thus, it shall not be affected by the <b>discard</b>, <b>ignore</b>, or 307 <b>retain</b> commands.) The formats of the remainder of the <b>From <space></b> line and any additional header lines are 308 unspecified, except that none shall be empty. The format of a message body line is also unspecified, except that no line following 309 an empty line shall start with <b>From <space></b>; <i>mailx</i> shall modify any such user-entered message body lines 310 (following an empty line and beginning with <b>From <space></b>) by adding one or more characters to precede the 311 <tt>'F'</tt>; it may add these characters to <b>From <space></b> lines that are not preceded by an empty line.</p> 312 <p>When a message from the system mailbox or entered by the user is not a text file, it is implementation-defined how such a 313 message is stored in files written by <i>mailx</i>.</p> 314 </blockquote> 315 <h4 class="mansect"><a name="tag_20_75_13" id="tag_20_75_13"></a>EXTENDED DESCRIPTION</h4> 316 <blockquote> 317 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The 318 functionality in the entire EXTENDED DESCRIPTION section shall be provided on implementations supporting the User Portability 319 Utilities option. The functionality described in this section shall be provided on implementations that support the User 320 Portability Utilities option (and the rest of this section is not further shaded for this option). <img src="../images/opt-end.gif" 321 alt="[Option End]" border="0"></p> 322 <p>The <i>mailx</i> utility need not support for all character encodings in all circumstances. For example, inter-system mail may 323 be restricted to 7-bit data by the underlying network, 8-bit data need not be portable to non-internationalized systems, and so on. 324 Under these circumstances, it is recommended that only characters defined in the ISO/IEC 646:1991 standard International 325 Reference Version (equivalent to ASCII) 7-bit range of characters be used.</p> 326 <p>When <i>mailx</i> is invoked using one of the Receive Mode synopsis forms, it shall write a page of header-summary lines (if 327 <b>-N</b> was not specified and there are messages, see below), followed by a prompt indicating that <i>mailx</i> can accept 328 regular commands (see <a href="#tag_20_75_13_03">Commands in mailx</a> ); this is termed <i>command mode</i>. The page of 329 header-summary lines shall contain the first new message if there are new messages, or the first unread message if there are unread 330 messages, or the first message. When <i>mailx</i> is invoked using the Send Mode synopsis and standard input is a terminal, if no 331 subject is specified on the command line and the <b>asksub</b> variable is set, a prompt for the subject shall be written. At this 332 point, <i>mailx</i> shall be in input mode. This input mode shall also be entered when using one of the Receive Mode synopsis forms 333 and a reply or new message is composed using the <b>reply</b>, <b>Reply</b>, <b>followup</b>, <b>Followup</b>, or <b>mail</b> 334 commands and standard input is a terminal. When the message is typed and the end of the message is encountered, the message shall 335 be passed to the mail delivery software. Commands can be entered by beginning a line with the escape character (by default, 336 <tilde> (<tt>'~'</tt>)) followed by a single command letter and optional arguments. See <a href="#tag_20_75_13_03">Commands 337 in mailx</a> for a summary of these commands. It is unspecified what effect these commands will have if standard input is not a 338 terminal when a message is entered using either the Send Mode synopsis, or the Read Mode commands <b>reply</b>, <b>Reply</b>, 339 <b>followup</b>, <b>Followup</b>, or <b>mail</b>. <basefont size="2"></p> 340 <dl> 341 <dt><b>Note:</b></dt> 342 <dd>For notational convenience, this section uses the default escape character, <tilde>, in all references and examples.</dd> 343 </dl> 344 <basefont size="3"> 345 <p>At any time, the behavior of <i>mailx</i> shall be governed by a set of environmental and internal variables. These are flags 346 and valued parameters that can be set and cleared via the <i>mailx</i> <b>set</b> and <b>unset</b> commands.</p> 347 <p>Regular commands are of the form:</p> 348 <pre> 349 <b>[</b><i>command</i><b>] [</b><i>msglist</i><b>] [</b><i>argument </i><tt>...</tt><b>] 350 </b></pre> 351 <p>If no <i>command</i> is specified in command mode, <b>next</b> shall be assumed. In input mode, commands shall be recognized by 352 the escape character, and lines not treated as commands shall be taken as input for the message.</p> 353 <p>In command mode, each message shall be assigned a sequential number, starting with 1.</p> 354 <p>All messages have a state that shall affect how they are displayed in the header summary and how they are retained or deleted 355 upon termination of <i>mailx</i>. There is at any time the notion of a <i>current</i> message, which shall be marked by a 356 <tt>'>'</tt> at the beginning of a line in the header summary. When <i>mailx</i> is invoked using one of the Receive Mode 357 synopsis forms, the current message shall be the first new message, if there is a new message, or the first unread message if there 358 is an unread message, or the first message if there are any messages, or unspecified if there are no messages in the mailbox. Each 359 command that takes an optional list of messages (<i>msglist</i>) or an optional single message (<i>message</i>) on which to operate 360 shall leave the current message set to the highest-numbered message of the messages specified, unless the command deletes messages, 361 in which case the current message shall be set to the first undeleted message (that is, a message not in the deleted state) after 362 the highest-numbered message deleted by the command, if one exists, or the first undeleted message before the highest-numbered 363 message deleted by the command, if one exists, or to an unspecified value if there are no remaining undeleted messages. All 364 messages shall be in one of the following states:</p> 365 <dl compact> 366 <dd></dd> 367 <dt><i>new</i></dt> 368 <dd>The message is present in the system mailbox and has not been viewed by the user or moved to any other state. Messages in state 369 <i>new</i> when <i>mailx</i> quits shall be retained in the system mailbox.</dd> 370 <dt><i>unread</i></dt> 371 <dd>The message has been present in the system mailbox for more than one invocation of <i>mailx</i> and has not been viewed by the 372 user or moved to any other state. Messages in state <i>unread</i> when <i>mailx</i> quits shall be retained in the system 373 mailbox.</dd> 374 <dt><i>read</i></dt> 375 <dd>The message has been processed by one of the following commands: <b>~f</b>, <b>~m</b>, <b>~F</b>, <b>~M</b>, <b>copy</b>, 376 <b>mbox</b>, <b>next</b>, <b>pipe</b>, <b>print</b>, <b>Print</b>, <b>top</b>, <b>type</b>, <b>Type</b>, <b>undelete</b>. The 377 <b>dp</b> and <b>dt</b> commands shall also cause the message they write, if any, to be marked as <i>read</i>. If the 378 <b>autoprint</b> variable is set, the <b>delete</b> command shall also cause the message it writes, if any, to be marked as 379 <i>read</i>. Messages that are in the system mailbox and in state <i>read</i> when <i>mailx</i> quits shall be saved in the 380 <b>mbox</b>, unless the internal variable <b>hold</b> was set. Messages that are in the <b>mbox</b> or in a secondary mailbox and 381 in state <i>read</i> when <i>mailx</i> quits shall be retained in their current location.</dd> 382 <dt><i>deleted</i></dt> 383 <dd>The message has been processed by one of the following commands: <b>delete</b>, <b>dp</b>, <b>dt</b>. Messages in state 384 <i>deleted</i> when <i>mailx</i> quits shall be deleted. Deleted messages shall be ignored until <i>mailx</i> quits or changes 385 mailboxes or they are specified to the undelete command; for example, the message specification /<i>string</i> shall only search 386 the <b>Subject</b> header fields of messages that have not yet been deleted, unless the command operating on the list of messages 387 is <b>undelete</b>. No deleted message or deleted message header shall be displayed by any <i>mailx</i> command other than 388 <b>undelete</b>.</dd> 389 <dt><i>preserved</i></dt> 390 <dd>The message has been processed by a <b>preserve</b> command. When <i>mailx</i> quits, the message shall be retained in its 391 current location.</dd> 392 <dt><i>saved</i></dt> 393 <dd>The message has been processed by one of the following commands: <b>save</b> or <b>write</b>. If the current mailbox is the 394 system mailbox, and the internal variable <b>keepsave</b> is set, messages in the state saved shall be saved to the file designated 395 by the <i>MBOX</i> variable (see the ENVIRONMENT VARIABLES section). If the current mailbox is the system mailbox, messages in the 396 state <i>saved</i> shall be deleted from the current mailbox, when the <b>quit</b> or <b>file</b> command is used to exit the 397 current mailbox.</dd> 398 </dl> 399 <p>The header-summary line for each message shall indicate the state of the message.</p> 400 <p>Many commands take an optional list of messages (<i>msglist</i>) on which to operate, which defaults to the current message. A 401 <i>msglist</i> is a list of message specifications separated by <blank> characters, which can include:</p> 402 <dl compact> 403 <dd></dd> 404 <dt><tt>n</tt></dt> 405 <dd>Message number <i>n</i>.</dd> 406 <dt><tt>+</tt></dt> 407 <dd>The next undeleted message, or the next deleted message for the <b>undelete</b> command.</dd> 408 <dt><tt>-</tt></dt> 409 <dd>The next previous undeleted message, or the next previous deleted message for the <b>undelete</b> command.</dd> 410 <dt><tt>.</tt></dt> 411 <dd>The current message.</dd> 412 <dt><tt>^</tt></dt> 413 <dd>The first undeleted message, or the first deleted message for the <b>undelete</b> command.</dd> 414 <dt><tt>$</tt></dt> 415 <dd>The last message.</dd> 416 <dt><tt>*</tt></dt> 417 <dd>All messages.</dd> 418 <dt><tt>n-m</tt></dt> 419 <dd>An inclusive range of message numbers.</dd> 420 <dt><i>address</i></dt> 421 <dd>All messages from <i>address</i>; any address as shown in a header summary shall be matchable in this form.</dd> 422 <dt>/<i>string</i></dt> 423 <dd>All messages with <i>string</i> in the <b>Subject</b> header field (case ignored).</dd> 424 <dt><tt>:c</tt></dt> 425 <dd>All messages of type <i>c</i>, where <i>c</i> shall be one of: 426 <dl compact> 427 <dd></dd> 428 <dt><tt>d</tt></dt> 429 <dd>Deleted messages.</dd> 430 <dt><tt>n</tt></dt> 431 <dd>New messages.</dd> 432 <dt><tt>o</tt></dt> 433 <dd>Old messages (any not in state <i>read</i> or <i>new</i>).</dd> 434 <dt><tt>r</tt></dt> 435 <dd>Read messages.</dd> 436 <dt><tt>u</tt></dt> 437 <dd>Unread messages.</dd> 438 </dl> 439 </dd> 440 </dl> 441 <p>Other commands take an optional message (<i>message</i>) on which to operate, which defaults to the current message. All of the 442 forms allowed for <i>msglist</i> are also allowed for <i>message</i>, but if more than one message is specified, only the first 443 shall be operated on.</p> 444 <p>Other arguments are usually arbitrary strings whose usage depends on the command involved.</p> 445 <h5><a name="tag_20_75_13_01" id="tag_20_75_13_01"></a>Start-Up in mailx</h5> 446 <p>At start-up time, <i>mailx</i> shall take the following steps in sequence:</p> 447 <ol> 448 <li> 449 <p>Establish all variables at their stated default values.</p> 450 </li> 451 <li> 452 <p>Process command line options, overriding corresponding default values.</p> 453 </li> 454 <li> 455 <p>Import any of the <i>DEAD ,</i> <i>EDITOR ,</i> <i>MBOX ,</i> <i>LISTER ,</i> <i>PAGER ,</i> <i>SHELL ,</i> or <i>VISUAL</i> 456 variables that are present in the environment, overriding the corresponding default values.</p> 457 </li> 458 <li> 459 <p>Read <i>mailx</i> commands from an unspecified system start-up file, unless the <b>-n</b> option is given, to initialize any 460 internal <i>mailx</i> variables and aliases.</p> 461 </li> 462 <li> 463 <p>Process the user start-up file of <i>mailx</i> commands named in the user <i>MAILRC</i> variable.</p> 464 </li> 465 </ol> 466 <p>Most regular <i>mailx</i> commands are valid inside start-up files, the most common use being to set up initial display options 467 and alias lists. The following commands shall be invalid in a start-up file: <b>!</b>, <b>edit</b>, <b>hold</b>, <b>mail</b>, 468 <b>preserve</b>, <b>reply</b>, <b>Reply</b>, <b>Save</b>, <b>shell</b>, <b>visual</b>, <b>Copy</b>, <b>followup</b>, and 469 <b>Followup</b>. Any errors in a start-up file shall either cause <i>mailx</i> to terminate with a diagnostic message and a 470 non-zero status or to continue after writing a diagnostic message, ignoring the remainder of the lines in the file.</p> 471 <p>A blank line in a start-up file shall be ignored.</p> 472 <h5><a name="tag_20_75_13_02" id="tag_20_75_13_02"></a>Internal Variables in mailx</h5> 473 <p>The following variables are internal <i>mailx</i> variables. Each internal variable can be set via the <i>mailx</i> <b>set</b> 474 command at any time. The <b>unset</b> and <b>set no</b><i>name</i> commands can be used to erase variables.</p> 475 <p>In the following list, variables shown as:</p> 476 <pre> 477 <tt>variable 478 </tt></pre> 479 <p>represent Boolean values. Variables shown as:</p> 480 <pre> 481 <tt>variable=</tt><i>value</i><tt> 482 </tt></pre> 483 <p>shall be assigned string or numeric values. For string values, the rules in <a href="#tag_20_75_13_03">Commands in mailx</a> 484 concerning filenames and quoting shall also apply.</p> 485 <p>The defaults specified here may be changed by the unspecified system start-up file unless the user specifies the <b>-n</b> 486 option.</p> 487 <dl compact> 488 <dd></dd> 489 <dt><b>allnet</b></dt> 490 <dd>All network names whose login name components match shall be treated as identical. This shall cause the <i>msglist</i> message 491 specifications to behave similarly. The default shall be <b>noallnet</b>. See also the <b>alternates</b> command and the 492 <b>metoo</b> variable.</dd> 493 <dt><b>append</b></dt> 494 <dd>Append messages to the end of the <b>mbox</b> file upon termination instead of placing them at the beginning. The default shall 495 be <b>noappend</b>. This variable shall not affect the <b>save</b> command when saving to <b>mbox</b>.</dd> 496 <dt><b>ask</b>, <b>asksub</b></dt> 497 <dd>Prompt for a value for the <b>Subject</b> header field on outgoing mail if one is not specified on the command line with the 498 <b>-s</b> option. The <b>ask</b> and <b>asksub</b> forms are synonyms; the system shall refer to <b>asksub</b> and <b>noasksub</b> 499 in its messages, but shall accept <b>ask</b> and <b>noask</b> as user input to mean <b>asksub</b> and <b>noasksub</b>. It shall not 500 be possible to set both <b>ask</b> and <b>noasksub</b>, or <b>noask</b> and <b>asksub</b>. The default shall be <b>asksub</b>, but 501 no prompting shall be done if standard input is not a terminal.</dd> 502 <dt><b>askbcc</b></dt> 503 <dd>Prompt for the blind copy list. The default shall be <b>noaskbcc</b>.</dd> 504 <dt><b>askcc</b></dt> 505 <dd>Prompt for the copy list. The default shall be <b>noaskcc</b>.</dd> 506 <dt><b>autoprint</b></dt> 507 <dd>Enable automatic writing of messages after <b>delete</b> and <b>undelete</b> commands. The default shall be 508 <b>noautoprint</b>.</dd> 509 <dt><b>bang</b></dt> 510 <dd>Enable the special-case treatment of <exclamation-mark> characters (<tt>'!'</tt>) in <b>!</b> commands and 511 <b>~!</b><i>command</i> escapes; see the <b>Invoke Shell Command</b> command and <a href="#tag_20_75_13_48">Command Escapes in 512 mailx</a> . The default shall be <b>nobang</b>, disabling the expansion of <tt>'!'</tt> in the <i>command</i> argument to the 513 <b>!</b> command and the <b>~!</b><i>command</i> escape.</dd> 514 <dt><b>cmd</b>=<i>command</i></dt> 515 <dd><br> 516 Set the default command to be invoked by the <b>pipe</b> command. The default shall be <b>nocmd</b>.</dd> 517 <dt><b>crt</b>=<i>number</i></dt> 518 <dd>Paginate message output as described for the <i>PAGER</i> variable. The default shall be <b>nocrt</b>, disabling this 519 pagination. If it is set to null, the value used is implementation-defined.</dd> 520 <dt><b>debug</b></dt> 521 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 522 Enable verbose diagnostics for debugging. Messages are not delivered. The default shall be <b>nodebug</b>. <img src= 523 "../images/opt-end.gif" alt="[Option End]" border="0"></dd> 524 <dt><b>dot</b></dt> 525 <dd>When <b>dot</b> is set, a <period> on a line by itself during message input from a terminal shall also signify 526 end-of-file (in addition to normal end-of-file). The default shall be <b>nodot</b>. If <b>ignoreeof</b> is set (see below), a 527 setting of <b>nodot</b> shall be ignored and <period> and the <b>~.</b> command escape are the only methods to terminate 528 input mode.</dd> 529 <dt><b>escape</b>=<i>c</i></dt> 530 <dd>Set the command escape character to be the character <tt>'c'</tt>. By default, the command escape character shall be 531 <tilde>. If <b>escape</b> is unset, <tilde> shall be used; if it is set to null, command escaping shall be 532 disabled.</dd> 533 <dt><b>flipr</b></dt> 534 <dd>Reverse the meanings of the <b>R</b> and <b>r</b> commands. The default shall be <b>noflipr</b>.</dd> 535 <dt><b>folder</b>=<i>directory</i></dt> 536 <dd><br> 537 The default directory for saving mail files. User-specified filenames beginning with a <plus-sign> (<tt>'+'</tt>) shall be 538 expanded by preceding the filename with this directory name to obtain the real pathname. If <i>directory</i> does not start with a 539 <slash> (<tt>'/'</tt>), the contents of <i>HOME</i> shall be prefixed to it. The default shall be <b>nofolder</b>. If 540 <b>folder</b> is unset, user-specified filenames beginning with <tt>'+'</tt> shall refer to files in the current directory that 541 begin with the literal <tt>'+'</tt> character. See also <b>outfolder</b> below. The <b>folder</b> value need not affect the 542 processing of the files named in <i>MBOX</i> and <i>DEAD .</i></dd> 543 <dt><b>header</b></dt> 544 <dd>Enable writing of the header summary when entering <i>mailx</i> in Receive Mode. The default shall be <b>header</b>.</dd> 545 <dt><b>hold</b></dt> 546 <dd>Disable message moving of read messages from the system mailbox to the <b>mbox</b> save file upon normal program termination or 547 folder change. This automatic mail management is complemented with the commands <b>hold</b> (and <b>preserve</b>), <b>mbox</b>, and 548 <b>touch</b>, which partially override the <b>hold</b> variable. The default shall be <b>nohold</b>.</dd> 549 <dt><b>ignore</b></dt> 550 <dd>Ignore interrupts while entering messages. The default shall be <b>noignore</b>.</dd> 551 <dt><b>ignoreeof</b></dt> 552 <dd>Ignore normal end-of-file during message input. Input can be terminated only by entering a <period> (<tt>'.'</tt>) on a 553 line by itself or by the <b>~.</b> command escape. The default shall be <b>noignoreeof</b>. See also <b>dot</b> above.</dd> 554 <dt><b>indentprefix</b>=<i>string</i></dt> 555 <dd><br> 556 A string that shall be added as a prefix to each line that is inserted into the message by the <b>~m</b> command escape. This 557 variable shall default to one <tab>.</dd> 558 <dt><b>keep</b></dt> 559 <dd>When a system mailbox, secondary mailbox, or <b>mbox</b> is empty, truncate it to zero length instead of removing it. The 560 default shall be <b>nokeep</b>.</dd> 561 <dt><b>keepsave</b></dt> 562 <dd>Keep the messages that have been saved from the system mailbox into other files in the file designated by the variable <i>MBOX 563 ,</i> instead of deleting them. The default shall be <b>nokeepsave</b>.</dd> 564 <dt><b>metoo</b></dt> 565 <dd>Suppress the deletion of the user's login name from the recipient list when replying to a message or sending to a group. The 566 default shall be <b>nometoo</b>.</dd> 567 <dt><b>onehop</b></dt> 568 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 569 When responding to a message that was originally sent to several recipients, the other recipient addresses are normally forced to 570 be relative to the originating author's machine for the response. This flag disables alteration of the recipients' addresses, 571 improving efficiency in a network where all machines can send directly to all other machines (that is, one hop away). The default 572 shall be <b>noonehop</b>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd> 573 <dt><b>outfolder</b></dt> 574 <dd>Cause the files used to record outgoing messages to be located in the directory specified by the <b>folder</b> variable unless 575 the pathname is absolute. The default shall be <b>nooutfolder</b>. See the <b>record</b> variable.</dd> 576 <dt><b>page</b></dt> 577 <dd>Insert a <form-feed> after each message sent through the pipe created by the <b>pipe</b> command. The default shall be 578 <b>nopage</b>.</dd> 579 <dt><b>prompt</b>=<i>string</i></dt> 580 <dd><br> 581 Set the command-mode prompt to <i>string</i>. If <i>string</i> is null or if <b>noprompt</b> is set, no prompting shall occur. The 582 default shall be to prompt with the string <tt>"? "</tt>.</dd> 583 <dt><b>quiet</b></dt> 584 <dd>Refrain from writing the opening message and version when entering <i>mailx</i>. The default shall be <b>noquiet</b>.</dd> 585 <dt><b>record</b>=<i>file</i></dt> 586 <dd>Record all outgoing mail in the file with the pathname <i>file</i>. The default shall be <b>norecord</b>. See also 587 <b>outfolder</b> above.</dd> 588 <dt><b>save</b></dt> 589 <dd>Enable saving of messages in the dead-letter file on interrupt or delivery error. See the variable <i>DEAD</i> for the location 590 of the dead-letter file. The default shall be <b>save</b>.</dd> 591 <dt><b>screen</b>=<i>number</i></dt> 592 <dd><br> 593 Set the number of lines in a screenful of headers for the <b>headers</b> and <b>z</b> commands. If <b>screen</b> is not specified, 594 a value based on the terminal type identified by the <i>TERM</i> environment variable, the window size, the baud rate, or some 595 combination of these shall be used. The default shall be <b>noscreen</b>.</dd> 596 <dt><b>sendwait</b></dt> 597 <dd>Wait for the background mailer to finish before returning. The default shall be <b>nosendwait</b>.</dd> 598 <dt><b>showto</b></dt> 599 <dd>When the sender of the message was the user who is invoking <i>mailx</i>, write the information from the <b>To</b> field 600 instead of the <b>From</b> field in the header summary. The default shall be <b>noshowto</b>.</dd> 601 <dt><b>sign</b>=<i>string</i></dt> 602 <dd>Set the variable inserted into the text of a message when the <b>~a</b> command escape is given. The default shall be 603 <b>nosign</b>. The character sequences <tt>'\t'</tt> and <tt>'\n'</tt> shall be recognized in the variable as <tab> and 604 <newline> characters, respectively. (See also <b>~i</b> in <a href="#tag_20_75_13_48">Command Escapes in mailx</a> .)</dd> 605 <dt><b>Sign</b>=<i>string</i></dt> 606 <dd>Set the variable inserted into the text of a message when the <b>~A</b> command escape is given. The default shall be 607 <b>noSign</b>. The character sequences <tt>'\t'</tt> and <tt>'\n'</tt> shall be recognized in the variable as <tab> and 608 <newline> characters, respectively.</dd> 609 <dt><b>toplines</b>=<i>number</i></dt> 610 <dd><br> 611 Set the number of lines of the message to write with the <b>top</b> command. The default shall be 5.</dd> 612 </dl> 613 <h5><a name="tag_20_75_13_03" id="tag_20_75_13_03"></a>Commands in mailx</h5> 614 <p>The following <i>mailx</i> commands shall be provided. In the following list, <i>header</i> refers to lines from the message 615 header, as shown in the OUTPUT FILES section. <i>Header field</i> refers to a line or set of lines within the header that begins 616 with one or more non-white-space characters immediately followed by a <colon> and white space, and continuing up to and 617 including a <newline> that immediately precedes either the next line beginning with a non-white-space character or an empty 618 line. <i>Field name</i> refers to the portion of a header field prior to the first <colon>.</p> 619 <p>For each of the commands listed below, the command can be entered as the abbreviation (those characters in the Synopsis command 620 word preceding the <tt>'['</tt>), the full command (all characters shown for the command word, omitting the <tt>'['</tt> and 621 <tt>']'</tt>), or any truncation of the full command down to the abbreviation. For example, the <b>exit</b> command (shown as 622 <b>ex[it]</b> in the Synopsis) can be entered as <b>ex</b>, <b>exi</b>, or <b>exit</b>.</p> 623 <p>The arguments to commands can be quoted, using the following methods:</p> 624 <ul> 625 <li> 626 <p>An argument can be enclosed between paired double-quotes (<tt>""</tt>) or single-quotes (<tt>''</tt>); any white space, shell 627 word expansion, or <backslash> characters within the quotes shall be treated literally as part of the argument. A 628 double-quote shall be treated literally within single-quotes and <i>vice versa</i>. These special properties of the 629 <quotation-mark> characters shall occur only when they are paired at the beginning and end of the argument.</p> 630 </li> 631 <li> 632 <p>A <backslash> outside of the enclosing quotes shall be discarded and the following character treated literally as part of 633 the argument.</p> 634 </li> 635 <li> 636 <p>An unquoted <backslash> at the end of a command line shall be discarded and the next line shall continue the command.</p> 637 </li> 638 </ul> 639 <br> 640 <p>Filenames, where expected, shall be subjected to the following transformations, in sequence:</p> 641 <ul> 642 <li> 643 <p>If the filename begins with an unquoted <plus-sign>, and the <b>folder</b> variable is defined (see the <b>folder</b> 644 variable), the <plus-sign> shall be replaced by the value of the <b>folder</b> variable followed by a <slash>. If the 645 <b>folder</b> variable is unset or is set to null, the filename shall be unchanged.</p> 646 </li> 647 <li> 648 <p>Shell word expansions shall be applied to the filename (see <a href="../utilities/V3_chap02.html#tag_19_06"><i>2.6 Word 649 Expansions</i></a> ). If more than a single pathname results from this expansion and the command is expecting one file, the effects 650 are unspecified.</p> 651 </li> 652 </ul> 653 <h5><a name="tag_20_75_13_04" id="tag_20_75_13_04"></a>Declare Aliases</h5> 654 <dl compact> 655 <dd></dd> 656 <dt><i>Synopsis</i>:</dt> 657 <dd> 658 <pre> 659 <tt>a</tt><b>[</b><tt>lias</tt><b>] [</b><i>alias </i><b>[</b><i>address</i><tt>...</tt><b>]]</b><tt> 660 g</tt><b>[</b><tt>roup</tt><b>] [</b><i>alias </i><b>[</b><i>address</i><tt>...</tt><b>]]</b><tt> 661 </tt></pre></dd> 662 </dl> 663 <p>Add the given addresses to the alias specified by <i>alias</i>. The names shall be substituted when <i>alias</i> is used as a 664 recipient address specified by the user in an outgoing message (that is, other recipients addressed indirectly through the 665 <b>reply</b> command shall not be substituted in this manner). Mail address alias substitution shall apply only when the alias 666 string is used as a full address; for example, when <b>hlj</b> is an alias, <i>hlj@posix.com</i> does not trigger the alias 667 substitution. Recursive expansion of an alias group member can be prevented by prefixing it with an unquoted <backslash>. If 668 no arguments are given, write a listing of the current aliases to standard output. If only an <i>alias</i> argument is given, write 669 a listing of the specified alias to standard output. These listings need not reflect the same order of addresses that were 670 entered.</p> 671 <h5><a name="tag_20_75_13_05" id="tag_20_75_13_05"></a>Declare Alternatives</h5> 672 <dl compact> 673 <dd></dd> 674 <dt><i>Synopsis</i>:</dt> 675 <dd> 676 <pre> 677 <tt>alt</tt><b>[</b><tt>ernates</tt><b>] </b><i>name</i><tt>... 678 </tt></pre></dd> 679 </dl> 680 <p>Declare a list of alternative addresses for the address consisting of the user's login name. When responding to a message, these 681 alternative addresses shall be removed from the list of recipients. The comparison of addresses shall be performed in a 682 case-insensitive manner. With no arguments, <b>alternates</b> shall write the current list of alternative addresses.</p> 683 <h5><a name="tag_20_75_13_06" id="tag_20_75_13_06"></a>Change Current Directory</h5> 684 <dl compact> 685 <dd></dd> 686 <dt><i>Synopsis</i>:</dt> 687 <dd> 688 <pre> 689 <tt>cd </tt><b>[</b><i>directory</i><b>]</b><tt> 690 ch</tt><b>[</b><tt>dir</tt><b>] [</b><i>directory</i><b>]</b><tt> 691 </tt></pre></dd> 692 </dl> 693 <p>Change directory. If <i>directory</i> is not specified, the contents of <i>HOME</i> shall be used.</p> 694 <h5><a name="tag_20_75_13_07" id="tag_20_75_13_07"></a>Copy Messages</h5> 695 <dl compact> 696 <dd></dd> 697 <dt><i>Synopsis</i>:</dt> 698 <dd> 699 <pre> 700 <tt>c</tt><b>[</b><tt>opy</tt><b>] [</b><i>file</i><b>]</b><tt> 701 c</tt><b>[</b><tt>opy</tt><b>] [</b><i>msglist</i><b>] </b><i>file</i><tt> 702 C</tt><b>[</b><tt>opy</tt><b>] [</b><i>msglist</i><b>]</b><tt> 703 </tt></pre></dd> 704 </dl> 705 <p>Copy messages to the file named by the pathname <i>file</i> without marking the messages as saved. Otherwise, it shall be 706 equivalent to the <b>save</b> command.</p> 707 <p>In the capitalized form, save the specified messages in a file whose name is derived from the author of the message to be saved, 708 without marking the messages as saved. Otherwise, it shall be equivalent to the <b>Save</b> command.</p> 709 <h5><a name="tag_20_75_13_08" id="tag_20_75_13_08"></a>Delete Messages</h5> 710 <dl compact> 711 <dd></dd> 712 <dt><i>Synopsis</i>:</dt> 713 <dd> 714 <pre> 715 <tt>d</tt><b>[</b><tt>elete</tt><b>] [</b><i>msglist</i><b>]</b><tt> 716 </tt></pre></dd> 717 </dl> 718 <p>Mark messages for deletion from the mailbox. The deletions shall not occur until <i>mailx</i> quits (see the <b>quit</b> 719 command) or changes mailboxes (see the <b>folder</b> command). If <b>autoprint</b> is set and there are messages remaining after 720 the <b>delete</b> command, the current message shall be written as described for the <b>print</b> command (see the <b>print</b> 721 command); otherwise, the <i>mailx</i> prompt shall be written.</p> 722 <h5><a name="tag_20_75_13_09" id="tag_20_75_13_09"></a>Discard Header Fields</h5> 723 <dl compact> 724 <dd></dd> 725 <dt><i>Synopsis</i>:</dt> 726 <dd> 727 <pre> 728 <tt>di</tt><b>[</b><tt>scard</tt><b>] [</b><i>field-name</i><tt>...</tt><b>]</b><tt> 729 ig</tt><b>[</b><tt>nore</tt><b>] [</b><i>field-name</i><tt>...</tt><b>]</b><tt> 730 </tt></pre></dd> 731 </dl> 732 <p>Suppress header fields with the specified field names when writing messages. Specified <i>field-name</i> arguments shall be 733 added to the list of suppressed field names. Examples of field names to ignore are <b>status</b> and <b>cc</b>. The header fields 734 shall be included when the message is saved. The <b>Print</b> and <b>Type</b> commands shall override this command. The comparison 735 of field names shall be performed in a case-insensitive manner. If no arguments are specified, write a list of the currently 736 suppressed field names to standard output; the listing need not reflect the same order of field names that were entered.</p> 737 <p>If both <b>retain</b> and <b>discard</b> commands are given, <b>discard</b> commands shall be ignored.</p> 738 <h5><a name="tag_20_75_13_10" id="tag_20_75_13_10"></a>Delete Messages and Display</h5> 739 <dl compact> 740 <dd></dd> 741 <dt><i>Synopsis</i>:</dt> 742 <dd> 743 <pre> 744 <tt>dp </tt><b>[</b><i>msglist</i><b>]</b><tt> 745 dt </tt><b>[</b><i>msglist</i><b>]</b><tt> 746 </tt></pre></dd> 747 </dl> 748 <p>Delete the specified messages as described for the <b>delete</b> command, except that the <b>autoprint</b> variable shall have 749 no effect, and the current message shall be written only if it was set to a message after the last message deleted by the command. 750 Otherwise, an informational message to the effect that there are no further messages in the mailbox shall be written, followed by 751 the <i>mailx</i> prompt.</p> 752 <h5><a name="tag_20_75_13_11" id="tag_20_75_13_11"></a>Echo a String</h5> 753 <dl compact> 754 <dd></dd> 755 <dt><i>Synopsis</i>:</dt> 756 <dd> 757 <pre> 758 <tt>ec</tt><b>[</b><tt>ho</tt><b>] </b><i>string</i><tt> ... 759 </tt></pre></dd> 760 </dl> 761 <p>Echo the given strings, equivalent to the shell <a href="../utilities/echo.html"><i>echo</i></a> utility.</p> 762 <h5><a name="tag_20_75_13_12" id="tag_20_75_13_12"></a>Edit Messages</h5> 763 <dl compact> 764 <dd></dd> 765 <dt><i>Synopsis</i>:</dt> 766 <dd> 767 <pre> 768 <tt>e</tt><b>[</b><tt>dit</tt><b>] [</b><i>msglist</i><b>]</b><tt> 769 </tt></pre></dd> 770 </dl> 771 <p>Edit the given messages. The messages shall be placed in a temporary file and the utility named by the <i>EDITOR</i> variable is 772 invoked to edit each file in sequence. The default <i>EDITOR</i> is unspecified.</p> 773 <p>The <b>edit</b> command does not modify the contents of those messages in the mailbox.</p> 774 <h5><a name="tag_20_75_13_13" id="tag_20_75_13_13"></a>Exit</h5> 775 <dl compact> 776 <dd></dd> 777 <dt><i>Synopsis</i>:</dt> 778 <dd> 779 <pre> 780 <tt>ex</tt><b>[</b><tt>it</tt><b>]</b><tt> 781 x</tt><b>[</b><tt>it</tt><b>]</b><tt> 782 </tt></pre></dd> 783 </dl> 784 <p>Exit from <i>mailx</i> without performing automatic message moving, or any other management tasks. See also <b>quit</b>.</p> 785 <h5><a name="tag_20_75_13_14" id="tag_20_75_13_14"></a>Change Folder</h5> 786 <dl compact> 787 <dd></dd> 788 <dt><i>Synopsis</i>:</dt> 789 <dd> 790 <pre> 791 <tt>fi</tt><b>[</b><tt>le</tt><b>] [</b><i>file</i><b>]</b><tt> 792 fold</tt><b>[</b><tt>er</tt><b>] [</b><i>file</i><b>]</b><tt> 793 </tt></pre></dd> 794 </dl> 795 <p>If no argument is given, write the name and status of the current mailbox. Otherwise, close the current file of messages after 796 performing actions as specified for the <b>quit</b> command (except for terminating <i>mailx</i>) and then read in the file named 797 by the pathname <i>file</i>. The behavior is unspecified if <i>file</i> is not a valid <b>mbox</b>.</p> 798 <p>Several unquoted special characters shall be recognized when used as <i>file</i> names, with the following substitutions:</p> 799 <dl compact> 800 <dd></dd> 801 <dt><tt>%</tt></dt> 802 <dd>The system mailbox for the invoking user.</dd> 803 <dt><tt>%</tt><i>user</i></dt> 804 <dd>The system mailbox for <i>user</i>.</dd> 805 <dt><tt>#</tt></dt> 806 <dd>The previous file.</dd> 807 <dt><tt>&</tt></dt> 808 <dd>The current <b>mbox</b>.</dd> 809 <dt><tt>+</tt><i>file</i></dt> 810 <dd>The named file in the <b>folder</b> directory. (See the <b>folder</b> variable.)</dd> 811 </dl> 812 <p>The default file shall be the current mailbox.</p> 813 <h5><a name="tag_20_75_13_15" id="tag_20_75_13_15"></a>Display List of Folders</h5> 814 <dl compact> 815 <dd></dd> 816 <dt><i>Synopsis</i>:</dt> 817 <dd> 818 <pre> 819 <tt>folders</tt> 820 </pre></dd> 821 </dl> 822 <p>Write the names of the files in the directory set by the <b>folder</b> variable. The command specified by the <i>LISTER</i> 823 environment variable shall be used (see the ENVIRONMENT VARIABLES section).</p> 824 <h5><a name="tag_20_75_13_16" id="tag_20_75_13_16"></a>Follow Up Specified Messages</h5> 825 <dl compact> 826 <dd></dd> 827 <dt><i>Synopsis</i>:</dt> 828 <dd> 829 <pre> 830 <tt>fo</tt><b>[</b><tt>llowup</tt><b>] [</b><i>message</i><b>]</b><tt> 831 F</tt><b>[</b><tt>ollowup</tt><b>] [</b><i>msglist</i><b>]</b><tt> 832 </tt></pre></dd> 833 </dl> 834 <p>The <b>followup</b> and <b>Followup</b> commands shall be equivalent to <b>reply</b> and <b>Reply</b>, respectively, except 835 that:</p> 836 <ul> 837 <li> 838 <p>They shall ignore the <b>record</b> variable.</p> 839 </li> 840 <li> 841 <p>The <b>followup</b> command shall record the response in a file whose name is derived from the author of the <i>message</i>.</p> 842 </li> 843 <li> 844 <p>The <b>Followup</b> command shall record the response in a file whose name is derived from the author of the first message in 845 the <i>msglist</i>.</p> 846 </li> 847 </ul> 848 <p>See also the <b>save</b> and <b>copy</b> commands and <b>outfolder</b>.</p> 849 <h5><a name="tag_20_75_13_17" id="tag_20_75_13_17"></a>Display Header Summary for Specified Messages</h5> 850 <dl compact> 851 <dd></dd> 852 <dt><i>Synopsis</i>:</dt> 853 <dd> 854 <pre> 855 <tt>f</tt><b>[</b><tt>rom</tt><b>] [</b><i>msglist</i><b>]</b><tt> 856 </tt></pre></dd> 857 </dl> 858 <p>Write the header summary for the specified messages.</p> 859 <h5><a name="tag_20_75_13_18" id="tag_20_75_13_18"></a>Display Header Summaries</h5> 860 <dl compact> 861 <dd></dd> 862 <dt><i>Synopsis</i>:</dt> 863 <dd> 864 <pre> 865 <tt>h</tt><b>[</b><tt>eaders</tt><b>] [</b><i>message</i><b>]</b><tt> 866 </tt></pre></dd> 867 </dl> 868 <p>Write the page of header summaries that includes the message specified. If the <i>message</i> argument is not specified, the 869 current message shall not change. However, if the <i>message</i> argument is specified, the current message shall become the 870 message that appears at the top of the page of header summaries that includes the message specified. The <b>screen</b> variable 871 sets the number of header summaries per page. See also the <b>z</b> command.</p> 872 <h5><a name="tag_20_75_13_19" id="tag_20_75_13_19"></a>Help</h5> 873 <dl compact> 874 <dd></dd> 875 <dt><i>Synopsis</i>:</dt> 876 <dd> 877 <pre> 878 <tt>hel</tt><b>[</b><tt>p</tt><b>]</b><tt> 879 ? 880 </tt></pre></dd> 881 </dl> 882 <p>Write a summary of commands.</p> 883 <h5><a name="tag_20_75_13_20" id="tag_20_75_13_20"></a>Hold Messages</h5> 884 <dl compact> 885 <dd></dd> 886 <dt><i>Synopsis</i>:</dt> 887 <dd> 888 <pre> 889 <tt>ho</tt><b>[</b><tt>ld</tt><b>] [</b><i>msglist</i><b>]</b><tt> 890 pre</tt><b>[</b><tt>serve</tt><b>] [</b><i>msglist</i><b>]</b><tt> 891 </tt></pre></dd> 892 </dl> 893 <p>Allowed only in the system mailbox. Mark the messages in <i>msglist</i> to be preserved, as if the <b>hold</b> variable were 894 set, upon normal termination or when the folder is changed. This shall override any commands that might previously have marked the 895 messages to be deleted, and only the <b>delete</b>, <b>dp</b>, or <b>dt</b>, as well as the <b>mbox</b> and <b>touch</b> commands, 896 shall remove the <i>preserve</i> mark of a message.</p> 897 <h5><a name="tag_20_75_13_21" id="tag_20_75_13_21"></a>Execute Commands Conditionally</h5> 898 <dl compact> 899 <dd></dd> 900 <dt><i>Synopsis</i>:</dt> 901 <dd> 902 <pre> 903 <tt>i</tt><b>[</b><tt>f</tt><b>]</b><tt> s|r 904 </tt><i>mail-command</i><tt>s 905 el</tt><b>[</b><tt>se</tt><b>] 906 </b><i>mail-command</i><tt>s 907 en</tt><b>[</b><tt>dif</tt><b>]</b><tt> 908 </tt></pre></dd> 909 </dl> 910 <p>Execute commands conditionally, where <b>if s</b> executes the following <i>mail-command</i>s, up to an <b>else</b> or 911 <b>endif</b>, if the program is in Send Mode, and <b>if r</b> shall cause the <i>mail-command</i>s to be executed only in 912 Receive Mode.</p> 913 <h5><a name="tag_20_75_13_22" id="tag_20_75_13_22"></a>List Available Commands</h5> 914 <dl compact> 915 <dd></dd> 916 <dt><i>Synopsis</i>:</dt> 917 <dd> 918 <pre> 919 <tt>l</tt><b>[</b><tt>ist</tt><b>]</b><tt> 920 </tt></pre></dd> 921 </dl> 922 <p>Write a list of all commands available. No explanation shall be given.</p> 923 <h5><a name="tag_20_75_13_23" id="tag_20_75_13_23"></a>Mail a Message</h5> 924 <dl compact> 925 <dd></dd> 926 <dt><i>Synopsis</i>:</dt> 927 <dd> 928 <pre> 929 <tt>m</tt><b>[</b><tt>ail</tt><b>] </b><i>address</i><tt>... 930 </tt></pre></dd> 931 </dl> 932 <p>Mail a message to the specified addresses or aliases.</p> 933 <h5><a name="tag_20_75_13_24" id="tag_20_75_13_24"></a>Direct Messages to mbox</h5> 934 <dl compact> 935 <dd></dd> 936 <dt><i>Synopsis</i>:</dt> 937 <dd> 938 <pre> 939 <tt>mb</tt><b>[</b><tt>ox</tt><b>] [</b><i>msglist</i><b>]</b><tt> 940 </tt></pre></dd> 941 </dl> 942 <p>Allowed only in the system mailbox. Arrange for the given messages to end up in the secondary mailbox, overriding a possibly set 943 <b>hold</b> variable, upon normal termination or when the folder is changed. Overrides a former <b>hold</b> or <b>preserve</b> 944 request. See <i>MBOX</i> in the ENVIRONMENT VARIABLES section. See also the <b>exit</b> and <b>quit</b> commands.</p> 945 <h5><a name="tag_20_75_13_25" id="tag_20_75_13_25"></a>Process Next Specified Message</h5> 946 <dl compact> 947 <dd></dd> 948 <dt><i>Synopsis</i>:</dt> 949 <dd> 950 <pre> 951 <tt>n</tt><b>[</b><tt>ext</tt><b>] [</b><i>message</i><b>]</b><tt> 952 </tt></pre></dd> 953 </dl> 954 <p>If the current message has not been written (for example, by the <b>print</b> command) since <i>mailx</i> started or since any 955 other message was the current message, behave as if the <b>print</b> command was entered. Otherwise, if there is an undeleted 956 message after the current message, make it the current message and behave as if the <b>print</b> command was entered. Otherwise, an 957 informational message to the effect that there are no further messages in the mailbox shall be written, followed by the 958 <i>mailx</i> prompt. Should the current message location be the result of an immediately preceding <b>hold</b>, <b>mbox</b>, 959 <b>preserve</b>, or <b>touch</b> command, <b>next</b> shall act as if the current message has already been written.</p> 960 <h5><a name="tag_20_75_13_26" id="tag_20_75_13_26"></a>Pipe Message</h5> 961 <dl compact> 962 <dd></dd> 963 <dt><i>Synopsis</i>:</dt> 964 <dd> 965 <pre> 966 <tt>pi</tt><b>[</b><tt>pe</tt><b>] [[</b><i>msglist</i><b>] </b><i>command</i><b>]</b><tt> 967 | </tt><b>[[</b><i>msglist</i><b>] </b><i>command</i><b>]</b><tt> 968 </tt></pre></dd> 969 </dl> 970 <p>Pipe the messages through the given <i>command</i> by invoking the command interpreter specified by <i>SHELL</i> with three 971 arguments: <tt>"-c"</tt>, <tt>"--"</tt>, and <i>command</i>. (See also <a href="../utilities/sh.html"><i>sh</i></a> <b>-c</b>.) The 972 application shall ensure that the command is given as a single argument. Quoting, described previously, can be used to accomplish 973 this. If no arguments are given, the current message shall be piped through the command specified by the value of the <b>cmd</b> 974 variable. If the <b>page</b> variable is set, a <form-feed> shall be inserted after each message.</p> 975 <h5><a name="tag_20_75_13_27" id="tag_20_75_13_27"></a>Display Message with Header</h5> 976 <dl compact> 977 <dd></dd> 978 <dt><i>Synopsis</i>:</dt> 979 <dd> 980 <pre> 981 <tt>P</tt><b>[</b><tt>rint</tt><b>] [</b><i>msglist</i><b>]</b><tt> 982 T</tt><b>[</b><tt>ype</tt><b>] [</b><i>msglist</i><b>]</b><tt> 983 </tt></pre></dd> 984 </dl> 985 <p>Write the specified messages, including all header fields, to standard output. This command shall override suppression of header 986 fields by the <b>discard</b>, <b>ignore</b>, and <b>retain</b> commands. If <b>crt</b> is set, the output shall be paginated as 987 described for the <i>PAGER</i> variable.</p> 988 <h5><a name="tag_20_75_13_28" id="tag_20_75_13_28"></a>Display Message</h5> 989 <dl compact> 990 <dd></dd> 991 <dt><i>Synopsis</i>:</dt> 992 <dd> 993 <pre> 994 <tt>p</tt><b>[</b><tt>rint</tt><b>] [</b><i>msglist</i><b>]</b><tt> 995 t</tt><b>[</b><tt>ype</tt><b>] [</b><i>msglist</i><b>]</b><tt> 996 </tt></pre></dd> 997 </dl> 998 <p>Write the specified messages to standard output. If <b>crt</b> is set, the output shall be paginated as described for the 999 <i>PAGER</i> variable.</p> 1000 <h5><a name="tag_20_75_13_29" id="tag_20_75_13_29"></a>Quit</h5> 1001 <dl compact> 1002 <dd></dd> 1003 <dt><i>Synopsis</i>:</dt> 1004 <dd> 1005 <pre> 1006 <tt>q</tt><b>[</b><tt>uit</tt><b>] 1007 </b><i>end-of-file</i><tt> 1008 </tt></pre></dd> 1009 </dl> 1010 <p>Terminate <i>mailx</i> normally, performing automatic message moving as specified in the description of the variable 1011 <b>hold</b>, deleting messages that have been explicitly saved (unless <b>keepsave</b> is set), discarding messages that have been 1012 deleted, and saving all remaining messages in the mailbox.</p> 1013 <h5><a name="tag_20_75_13_30" id="tag_20_75_13_30"></a>Reply to a Message or a Message List</h5> 1014 <dl compact> 1015 <dd></dd> 1016 <dt><i>Synopsis</i>:</dt> 1017 <dd> 1018 <pre> 1019 <tt>r</tt><b>[</b><tt>eply</tt><b>] [</b><i>message</i><b>]</b><tt> 1020 r</tt><b>[</b><tt>espond</tt><b>] [</b><i>message</i><b>]</b><tt> 1021 R</tt><b>[</b><tt>eply</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1022 R</tt><b>[</b><tt>espond</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1023 </tt></pre></dd> 1024 </dl> 1025 <p>Mail a reply message to one or more addresses taken from certain header fields in the specified message or message list. If the 1026 <b>flipr</b> variable is unset, these commands shall behave as described below. If the <b>flipr</b> variable is set, commands in 1027 the lowercase form shall behave as described below for commands in the capitalized form, and <i>vice versa</i>; the synopsis forms 1028 shown above shall also be swapped accordingly.</p> 1029 <p>The recipients of the reply message shall be determined by first constructing an initial list of recipients and then modifying 1030 it to form the list that is in effect when <i>mailx</i> enters input mode.</p> 1031 <p>In the capitalized form, the initial list of recipients shall be taken from the header of each message in the <i>msglist</i> as 1032 follows:</p> 1033 <ul> 1034 <li> 1035 <p>If the header contains a <b>Reply-To</b> field, the address or addresses in that field shall be added to the list.</p> 1036 </li> 1037 <li> 1038 <p>Otherwise, the address or addresses in the <b>From</b> field of the header shall be added to the list.</p> 1039 </li> 1040 </ul> 1041 <p>In the lowercase form, the initial list of recipients shall be taken from the header of the <i>message</i> as follows:</p> 1042 <ul> 1043 <li> 1044 <p>If the header does not contain a <b>Reply-To</b> field, all of the addresses in the <b>From</b>, <b>To</b>, and <b>Cc</b> fields 1045 shall be included in the list.</p> 1046 </li> 1047 <li> 1048 <p>Otherwise, it is implementation-defined whether all of the addresses in the <b>Reply-To</b>, <b>To</b>, and <b>Cc</b> fields are 1049 included in the list or only the address or addresses in the <b>Reply-To</b> field.</p> 1050 </li> 1051 </ul> 1052 <p>The initial list of recipients shall be marked for placement in the header fields of the reply message as follows. Recipient 1053 addresses taken from a <b>From</b> or <b>Reply-To</b> header field shall be marked for placement in the <b>To</b> field of the 1054 reply message. Recipient addresses taken from a <b>Cc</b> header field shall be marked for placement in the <b>Cc</b> field of the 1055 reply message. Recipient addresses taken from a <b>To</b> header field shall be marked for placement in either the <b>To</b> or the 1056 <b>Cc</b> field of the reply message. Implementations shall provide a way to place them in the <b>To</b> field. Implementations 1057 may, but need not, provide an implementation-defined way to place them in the <b>Cc</b> field.</p> 1058 <p>The modifications applied to the initial list of recipients shall be as follows:</p> 1059 <ul> 1060 <li> 1061 <p>If the <b>metoo</b> variable is unset, addresses consisting of the login name of the user and any alternative addresses declared 1062 using the <b>alternates</b> command shall be removed from the list.</p> 1063 </li> 1064 <li> 1065 <p>The set of recipients marked for placement in the <b>To</b> header field of the reply message shall have duplicates within that 1066 set removed.</p> 1067 </li> 1068 <li> 1069 <p>The set of recipients marked for placement in the <b>Cc</b> header field of the reply message shall have duplicates within that 1070 set removed and may have recipients that are also marked for placement in the <b>To</b> field removed.</p> 1071 </li> 1072 </ul> 1073 <p>The values for the <b>To</b> and <b>Cc</b> header fields of the reply message shall be constructed from the addresses in the 1074 modified list of recipients that are marked for placement in each of those fields.</p> 1075 <p>The value for the <b>Subject</b> header field of the reply message shall be formed from the value of the <b>Subject</b> header 1076 field of the <i>message</i> or the first message in <i>msglist</i> by prefixing it with <b>Re:</b><space>, unless it already 1077 begins with that string.</p> 1078 <p>The values of the <b>To</b>, <b>Cc</b>, and <b>Subject</b> header fields set as described above can be modified by the user 1079 after <i>mailx</i> enters input mode through the use of the <b>~t</b>, <b>~c</b>, <b>~s</b>, and <b>~h</b> command escapes.</p> 1080 <p>If <b>record</b> is set to a pathname, the response shall be saved at the end of that file.</p> 1081 <h5><a name="tag_20_75_13_31" id="tag_20_75_13_31"></a>Retain Header Fields</h5> 1082 <dl compact> 1083 <dd></dd> 1084 <dt><i>Synopsis</i>:</dt> 1085 <dd> 1086 <pre> 1087 <tt>ret</tt><b>[</b><tt>ain</tt><b>] [</b><i>field-name</i><tt>...</tt><b>]</b><tt> 1088 </tt></pre></dd> 1089 </dl> 1090 <p>Retain header fields with the specified field names when writing messages. This command shall override all <b>discard</b> and 1091 <b>ignore</b> commands. The comparison of field names shall be performed in a case-insensitive manner. If no arguments are 1092 specified, write a list of the currently retained field names to standard output; the listing need not reflect the same order of 1093 field names that were entered.</p> 1094 <h5><a name="tag_20_75_13_32" id="tag_20_75_13_32"></a>Save Messages</h5> 1095 <dl compact> 1096 <dd></dd> 1097 <dt><i>Synopsis</i>:</dt> 1098 <dd> 1099 <pre> 1100 <tt>s</tt><b>[</b><tt>ave</tt><b>] [</b><i>file</i><b>]</b><tt> 1101 s</tt><b>[</b><tt>ave</tt><b>] [</b><i>msglist</i><b>] </b><i>file</i><tt> 1102 S</tt><b>[</b><tt>ave</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1103 </tt></pre></dd> 1104 </dl> 1105 <p>Save the specified messages in the file named by the pathname <i>file</i>, or the <b>mbox</b> if the <i>file</i> argument is 1106 omitted. The file shall be created if it does not exist; otherwise, the messages shall be appended to the file. The message shall 1107 be put in the state <i>saved</i>, and shall behave as specified in the description of the <i>saved</i> state when the current 1108 mailbox is exited by the <b>quit</b> or <b>file</b> command.</p> 1109 <p>In the capitalized form, save the specified messages in a file whose name is derived from the author of the first message. The 1110 name of the file shall be taken to be the author's name with all network addressing stripped off. See also the <b>Copy</b>, 1111 <b>followup</b>, and <b>Followup</b> commands and <b>outfolder</b> variable.</p> 1112 <h5><a name="tag_20_75_13_33" id="tag_20_75_13_33"></a>Set Variables</h5> 1113 <dl compact> 1114 <dd></dd> 1115 <dt><i>Synopsis</i>:</dt> 1116 <dd> 1117 <pre> 1118 <tt>se</tt><b>[</b><tt>t</tt><b>] [</b><i>name</i><b>[</b><tt>=</tt><b>[</b><i>string</i><b>]] </b><tt>...</tt><b>] [</b><i>name</i><tt>=</tt><i>number </i><tt>...</tt><b>] [</b><tt>no</tt><i>name </i><tt>...</tt><b>]</b><tt> 1119 </tt></pre></dd> 1120 </dl> 1121 <p>Define one or more variables called <i>name</i>. The variable can be given a null, string, or numeric value. Quoting and 1122 <backslash>-escapes can occur anywhere in <i>string</i>, as described previously, as if the <i>string</i> portion of the 1123 argument were the entire argument. The forms <i>name</i> and <i>name</i>= shall be equivalent to <i>name</i>="" for variables that 1124 take string values. The <b>set</b> command without arguments shall write a list of all defined variables and their values. The 1125 <b>no</b> <i>name</i> form shall be equivalent to <b>unset</b> <i>name</i>.</p> 1126 <h5><a name="tag_20_75_13_34" id="tag_20_75_13_34"></a>Invoke a Shell</h5> 1127 <dl compact> 1128 <dd></dd> 1129 <dt><i>Synopsis</i>:</dt> 1130 <dd> 1131 <pre> 1132 <tt>sh</tt><b>[</b><tt>ell</tt><b>]</b><tt> 1133 </tt></pre></dd> 1134 </dl> 1135 <p>Invoke an interactive command interpreter (see also <i>SHELL ).</i></p> 1136 <h5><a name="tag_20_75_13_35" id="tag_20_75_13_35"></a>Display Message Size</h5> 1137 <dl compact> 1138 <dd></dd> 1139 <dt><i>Synopsis</i>:</dt> 1140 <dd> 1141 <pre> 1142 <tt>si</tt><b>[</b><tt>ze</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1143 </tt></pre></dd> 1144 </dl> 1145 <p>Write the size in bytes of each of the specified messages.</p> 1146 <h5><a name="tag_20_75_13_36" id="tag_20_75_13_36"></a>Read mailx Commands From a File</h5> 1147 <dl compact> 1148 <dd></dd> 1149 <dt><i>Synopsis</i>:</dt> 1150 <dd> 1151 <pre> 1152 <tt>so</tt><b>[</b><tt>urce</tt><b>] </b><i>file</i><tt> 1153 </tt></pre></dd> 1154 </dl> 1155 <p>Read and execute commands from the file named by the pathname <i>file</i> and return to command mode.</p> 1156 <h5><a name="tag_20_75_13_37" id="tag_20_75_13_37"></a>Display Beginning of Messages</h5> 1157 <dl compact> 1158 <dd></dd> 1159 <dt><i>Synopsis</i>:</dt> 1160 <dd> 1161 <pre> 1162 <tt>to</tt><b>[</b><tt>p</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1163 </tt></pre></dd> 1164 </dl> 1165 <p>Write the top few lines of each of the specified messages. If the <b>toplines</b> variable is set, it is taken as the number of 1166 lines to write. The default shall be 5.</p> 1167 <h5><a name="tag_20_75_13_38" id="tag_20_75_13_38"></a>Touch Messages</h5> 1168 <dl compact> 1169 <dd></dd> 1170 <dt><i>Synopsis</i>:</dt> 1171 <dd> 1172 <pre> 1173 <tt>tou</tt><b>[</b><tt>ch</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1174 </tt></pre></dd> 1175 </dl> 1176 <p>Allowed only in the system mailbox. Touch the specified messages. Unless overridden by the <b>hold</b> variable, any message in 1177 <i>msglist</i> that is not specifically deleted nor saved in a file shall be placed in the <b>mbox</b> upon normal termination or 1178 when the folder is changed. Overrides a former <b>hold</b> or <b>preserve</b> request.</p> 1179 <h5><a name="tag_20_75_13_39" id="tag_20_75_13_39"></a>Delete Aliases</h5> 1180 <dl compact> 1181 <dd></dd> 1182 <dt><i>Synopsis</i>:</dt> 1183 <dd> 1184 <pre> 1185 <tt>una</tt><b>[</b><tt>lias</tt><b>] [</b><i>alias</i><b>]</b><tt>... 1186 </tt></pre></dd> 1187 </dl> 1188 <p>Delete the specified alias names. If a specified alias does not exist, the results are unspecified.</p> 1189 <h5><a name="tag_20_75_13_40" id="tag_20_75_13_40"></a>Undelete Messages</h5> 1190 <dl compact> 1191 <dd></dd> 1192 <dt><i>Synopsis</i>:</dt> 1193 <dd> 1194 <pre> 1195 <tt>u</tt><b>[</b><tt>ndelete</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1196 </tt></pre></dd> 1197 </dl> 1198 <p>Change the state of the specified messages from deleted to read. If <b>autoprint</b> is set, the last message of those restored 1199 shall be written. If <i>msglist</i> is not specified, the message shall be selected as follows:</p> 1200 <ul> 1201 <li> 1202 <p>If there are any deleted messages that follow the current message, the first of these shall be chosen.</p> 1203 </li> 1204 <li> 1205 <p>Otherwise, the last deleted message that also precedes the current message shall be chosen.</p> 1206 </li> 1207 </ul> 1208 <h5><a name="tag_20_75_13_41" id="tag_20_75_13_41"></a>Unset Variables</h5> 1209 <dl compact> 1210 <dd></dd> 1211 <dt><i>Synopsis</i>:</dt> 1212 <dd> 1213 <pre> 1214 <tt>uns</tt><b>[</b><tt>et</tt><b>] </b><i>name</i><tt>... 1215 </tt></pre></dd> 1216 </dl> 1217 <p>Cause the specified variables to be erased.</p> 1218 <h5><a name="tag_20_75_13_42" id="tag_20_75_13_42"></a>Edit Message with Full-Screen Editor</h5> 1219 <dl compact> 1220 <dd></dd> 1221 <dt><i>Synopsis</i>:</dt> 1222 <dd> 1223 <pre> 1224 <tt>v</tt><b>[</b><tt>isual</tt><b>] [</b><i>msglist</i><b>]</b><tt> 1225 </tt></pre></dd> 1226 </dl> 1227 <p>Edit the given messages with a screen editor. Each message shall be placed in a temporary file, and the utility named by the 1228 <i>VISUAL</i> variable shall be invoked to edit each file in sequence. The default editor shall be <a href= 1229 "../utilities/vi.html"><i>vi</i></a>.</p> 1230 <p>The <b>visual</b> command does not modify the contents of those messages in the mailbox.</p> 1231 <h5><a name="tag_20_75_13_43" id="tag_20_75_13_43"></a>Write Messages to a File</h5> 1232 <dl compact> 1233 <dd></dd> 1234 <dt><i>Synopsis</i>:</dt> 1235 <dd> 1236 <pre> 1237 <tt>w</tt><b>[</b><tt>rite</tt><b>] [</b><i>msglist</i><b>] </b><i>file</i><tt> 1238 </tt></pre></dd> 1239 </dl> 1240 <p>Write the given messages to the file specified by the pathname <i>file</i>, minus the message header. Otherwise, it shall be 1241 equivalent to the <b>save</b> command.</p> 1242 <h5><a name="tag_20_75_13_44" id="tag_20_75_13_44"></a>Scroll Header Display</h5> 1243 <dl compact> 1244 <dd></dd> 1245 <dt><i>Synopsis</i>:</dt> 1246 <dd> 1247 <pre> 1248 <tt>z</tt><b>[</b><tt>+|-</tt><b>]</b><tt> 1249 </tt></pre></dd> 1250 </dl> 1251 <p>Scroll the header display forward (if <tt>'+'</tt> is specified or if no option is specified) or backward (if <tt>'-'</tt> is 1252 specified) one screenful. The number of header summaries written shall be set by the <b>screen</b> variable.</p> 1253 <h5><a name="tag_20_75_13_45" id="tag_20_75_13_45"></a>Invoke Shell Command</h5> 1254 <dl compact> 1255 <dd></dd> 1256 <dt><i>Synopsis</i>:</dt> 1257 <dd> 1258 <pre> 1259 <tt>!</tt><i>command</i><tt> 1260 </tt></pre></dd> 1261 </dl> 1262 <p>Invoke the command interpreter specified by <i>SHELL</i> with three arguments: <tt>"-c"</tt>, <tt>"--"</tt>, and <i>command</i>. 1263 (See also <a href="../utilities/sh.html"><i>sh</i></a> <b>-c</b>.) If the <b>bang</b> variable is set, each unescaped occurrence of 1264 <tt>'!'</tt> in <i>command</i> shall be replaced with the command executed by the previous <b>!</b> command or <b>~!</b> command 1265 escape.</p> 1266 <h5><a name="tag_20_75_13_46" id="tag_20_75_13_46"></a>Null Command</h5> 1267 <dl compact> 1268 <dd></dd> 1269 <dt><i>Synopsis</i>:</dt> 1270 <dd> 1271 <pre> 1272 <tt># </tt><i>comment</i><tt> 1273 </tt></pre></dd> 1274 </dl> 1275 <p>This null command (comment) shall be ignored by <i>mailx</i>.</p> 1276 <h5><a name="tag_20_75_13_47" id="tag_20_75_13_47"></a>Display Current Message Number</h5> 1277 <dl compact> 1278 <dd></dd> 1279 <dt><i>Synopsis</i>:</dt> 1280 <dd> 1281 <pre> 1282 <tt>= 1283 </tt></pre></dd> 1284 </dl> 1285 <p>Write the current message number.</p> 1286 <h5><a name="tag_20_75_13_48" id="tag_20_75_13_48"></a>Command Escapes in mailx</h5> 1287 <p>The following commands can be entered only from input mode, by beginning a line with the escape character (by default, 1288 <tilde> (<tt>'~'</tt>)). See the <b>escape</b> variable description for changing this special character. The format for the 1289 commands shall be:</p> 1290 <pre> 1291 <tt><</tt><i>escape-character</i><tt>><</tt><i>command-char</i><tt>><</tt><i>separator</i><tt>></tt><b>[</b><tt><</tt><i>arguments</i><tt>></tt><b>]</b><tt> 1292 </tt></pre> 1293 <p>where the <<i>separator</i>> can be zero or more <blank> characters.</p> 1294 <p>In the following descriptions, the application shall ensure that the argument <i>command</i> (but not <i>mailx-command)</i> is a 1295 shell command string. Any string acceptable to the command interpreter specified by the <i>SHELL</i> variable when it is invoked as 1296 <i>SHELL</i> <b>-c</b> <i>command_string</i> shall be valid. The command can be presented as multiple arguments (that is, quoting 1297 is not required).</p> 1298 <p>Command escapes that are listed with <i>msglist</i> or <i>mailx-command</i> arguments are invalid in Send Mode and produce 1299 unspecified results.</p> 1300 <dl compact> 1301 <dd></dd> 1302 <dt><b>~! </b><i>command</i></dt> 1303 <dd>Invoke the command interpreter specified by <i>SHELL</i> with three arguments: <tt>"-c"</tt>, <tt>"--"</tt>, and 1304 <i>command</i>; and then return to input mode. If the <b>bang</b> variable is set, each unescaped occurrence of <tt>'!'</tt> in 1305 <i>command</i> shall be replaced with the command executed by the previous <b>!</b> command or <b>~!</b> command escape.</dd> 1306 <dt><b>~.</b></dt> 1307 <dd>Simulate end-of-file (terminate message input).</dd> 1308 <dt><b>~: </b><i>mailx-command</i>, <b>~_ </b><i>mailx-command</i></dt> 1309 <dd><br> 1310 Perform the command-level request.</dd> 1311 <dt><b>~?</b></dt> 1312 <dd>Write a summary of command escapes.</dd> 1313 <dt><b>~A</b></dt> 1314 <dd>This shall be equivalent to <b>~i Sign</b>.</dd> 1315 <dt><b>~a</b></dt> 1316 <dd>This shall be equivalent to <b>~i sign</b>.</dd> 1317 <dt><b>~b </b><i>name</i>...</dt> 1318 <dd>Add the <i>name</i>s to the blind carbon copy (<b>Bcc</b>) list.</dd> 1319 <dt><b>~c </b><i>name</i>...</dt> 1320 <dd>Add the <i>name</i>s to the carbon copy (<b>Cc</b>) list.</dd> 1321 <dt><b>~d</b></dt> 1322 <dd>Read in the dead-letter file. See <i>DEAD</i> for a description of this file.</dd> 1323 <dt><b>~e</b></dt> 1324 <dd>Invoke the editor, as specified by the <i>EDITOR</i> environment variable, on the partial message.</dd> 1325 <dt><b>~f [</b><i>msglist</i><b>]</b></dt> 1326 <dd>Forward the specified messages. The specified messages, including their headers, shall be inserted into the current message 1327 without alteration. The header fields included in each header shall be affected by the <b>discard</b>, <b>ignore</b>, and 1328 <b>retain</b> commands.</dd> 1329 <dt><b>~F [</b><i>msglist</i><b>]</b></dt> 1330 <dd>This shall be the equivalent of the <b>~f</b> command escape, except that all header fields shall be included in the message 1331 headers, regardless of previous <b>discard</b>, <b>ignore</b>, and <b>retain</b> commands.</dd> 1332 <dt><b>~h</b></dt> 1333 <dd>If standard input is a terminal, prompt for values for the <b>Subject</b>, <b>To</b>, <b>Cc</b>, and <b>Bcc</b> header fields. 1334 Other implementation-defined header fields may also be presented for editing. If the header field is written with an initial value, 1335 it can be edited as if it had just been typed.</dd> 1336 <dt><b>~i </b><i>string</i></dt> 1337 <dd>Insert the value of the named variable, followed by a <newline>, into the text of the message. If the string is unset or 1338 null, the message shall not be changed.</dd> 1339 <dt><b>~m [</b><i>msglist</i><b>]</b></dt> 1340 <dd>Insert the specified messages, including their headers, into the current message, prefixing non-empty lines with the string in 1341 the <b>indentprefix</b> variable. The header fields included in each header shall be affected by the <b>discard</b>, <b>ignore</b>, 1342 and <b>retain</b> commands.</dd> 1343 <dt><b>~M [</b><i>msglist</i><b>]</b></dt> 1344 <dd>This shall be the equivalent of the <b>~m</b> command escape, except that all header fields shall be included in the message 1345 headers, regardless of previous <b>discard</b>, <b>ignore</b>, and <b>retain</b> commands.</dd> 1346 <dt><b>~p</b></dt> 1347 <dd>Write the message being entered. If the message is longer than <b>crt</b> lines (see <a href="#tag_20_75_13_02">Internal 1348 Variables in mailx</a> ), the output shall be paginated as described for the <i>PAGER</i> variable.</dd> 1349 <dt><b>~q</b></dt> 1350 <dd>Quit (see the <b>quit</b> command) from input mode by simulating an interrupt. If the body of the message is not empty, the 1351 partial message shall be saved in the dead-letter file. See <i>DEAD</i> for a description of this file.</dd> 1352 <dt> 1353 <b>~r </b><i>file</i>, <b>~< </b><i>file</i>, <b>~r !</b><i>command</i>, <b>~< !</b><i>command</i></dt> 1354 <dd><br> 1355 Read in the file specified by the pathname <i>file</i>. If the argument begins with an <exclamation-mark> (<tt>'!'</tt>), the 1356 rest of the string shall be taken as an arbitrary system command; the command interpreter specified by <i>SHELL</i> shall be 1357 invoked with three arguments: <tt>"-c"</tt>, <tt>"--"</tt>, and <i>command</i>. The standard output of <i>command</i> shall be 1358 inserted into the message.</dd> 1359 <dt><b>~s </b><i>string</i></dt> 1360 <dd>Set the value for the <b>Subject</b> header field to <i>string</i>.</dd> 1361 <dt><b>~t </b><i>name</i>...</dt> 1362 <dd>Add the given <i>name</i>s to the <b>To</b> list.</dd> 1363 <dt><b>~v</b></dt> 1364 <dd>Invoke the full-screen editor, as specified by the <i>VISUAL</i> environment variable, on the partial message.</dd> 1365 <dt><b>~w </b><i>file</i></dt> 1366 <dd>Write the partial message, without the header, onto the file named by the pathname <i>file</i>. The file shall be created or 1367 the message shall be appended to it if the file exists.</dd> 1368 <dt><b>~x</b></dt> 1369 <dd>Exit as with <b>~q</b>, except the message shall not be saved in the dead-letter file.</dd> 1370 <dt><b>~| </b><i>command</i></dt> 1371 <dd>Pipe the body of the message through the given <i>command</i> by invoking the command interpreter specified by <i>SHELL</i> 1372 with three arguments: <tt>"-c"</tt>, <tt>"--"</tt>, and <i>command</i>. If the <i>command</i> returns a successful exit status, the 1373 standard output of the command shall replace the message. Otherwise, the message shall remain unchanged. If the <i>command</i> 1374 fails, an error message giving the exit status shall be written.</dd> 1375 </dl> 1376 <br></blockquote> 1377 <h4 class="mansect"><a name="tag_20_75_14" id="tag_20_75_14"></a>EXIT STATUS</h4> 1378 <blockquote> 1379 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 1380 When the <b>-e</b> option is specified, the following exit values are returned:</p> 1381 <dl compact> 1382 <dd></dd> 1383 <dt> 0</dt> 1384 <dd>Mail was found.</dd> 1385 <dt>>0</dt> 1386 <dd>Mail was not found or an error occurred.</dd> 1387 </dl> 1388 <img src="../images/opt-end.gif" alt="[Option End]" border="0"> 1389 <p>Otherwise, the following exit values are returned:</p> 1390 <dl compact> 1391 <dd></dd> 1392 <dt> 0</dt> 1393 <dd>Successful completion; note that this status implies that any messages that <i>mailx</i> was instructed to send were all 1394 successfully either <i>sent</i> or discarded (see <b>-E</b>), but it gives no assurances that any of them were actually 1395 <i>delivered</i>.</dd> 1396 <dt>>0</dt> 1397 <dd>An error occurred.</dd> 1398 </dl> 1399 </blockquote> 1400 <h4 class="mansect"><a name="tag_20_75_15" id="tag_20_75_15"></a>CONSEQUENCES OF ERRORS</h4> 1401 <blockquote> 1402 <p>When in <sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border= 1403 "0"> input mode (Receive Mode) <img src="../images/opt-end.gif" alt="[Option End]" border="0"> or Send Mode:</p> 1404 <ul> 1405 <li> 1406 <p>If an error is encountered processing an input line beginning with a <tilde> (<tt>'~'</tt>) character, <sup>[<a href= 1407 "javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> (see <a href= 1408 "#tag_20_75_13_48">Command Escapes in mailx</a> ), <img src="../images/opt-end.gif" alt="[Option End]" border="0"> a 1409 diagnostic message shall be written to standard error, and the message being composed may be modified, but this condition shall not 1410 prevent the message from being sent.</p> 1411 </li> 1412 <li> 1413 <p>Other errors shall prevent the sending of the message.</p> 1414 </li> 1415 </ul> 1416 <p><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 1417 When in command mode:</p> 1418 <ul> 1419 <li> 1420 <p>Default.</p> 1421 </li> 1422 </ul> 1423 <img src="../images/opt-end.gif" alt="[Option End]" border="0"></blockquote> 1424 <hr> 1425 <div class="box"><em>The following sections are informative.</em></div> 1426 <h4 class="mansect"><a name="tag_20_75_16" id="tag_20_75_16"></a>APPLICATION USAGE</h4> 1427 <blockquote> 1428 <p>Delivery of messages to remote systems requires the existence of communication paths to such systems. These need not exist.</p> 1429 <p>Input lines are limited to {LINE_MAX} bytes, but mailers between systems may impose more severe line-length restrictions. This 1430 volume of POSIX.1-2024 does not place any restrictions on the length of messages handled by <i>mailx</i>, and for delivery of local 1431 messages the only limitations should be the normal problems of available disk space for the target mail file. When sending messages 1432 to external machines, applications are advised to limit messages to less than 100000 bytes because some mail gateways impose 1433 message-length restrictions.</p> 1434 <p>The format of the system mailbox is intentionally unspecified. Not all systems implement system mailboxes as flat files, 1435 particularly with the advent of multimedia mail messages. Some system mailboxes may be multiple files, others records in a 1436 database. The internal format of the messages themselves is specified with the historical format from Version 7, but only 1437 after the messages have been saved in some file other than the system mailbox. This was done so that many historical applications 1438 expecting text-file mailboxes are not broken.</p> 1439 <p>Some new formats for messages can be expected in the future, probably including binary data, bit maps, and various multimedia 1440 objects. As described here, <i>mailx</i> is not prohibited from handling such messages, but it must store them as text files in 1441 secondary mailboxes (unless some extension, such as a variable or command line option, is used to change the stored format). Its 1442 method of doing so is implementation-defined and might include translating the data into text file-compatible or readable form or 1443 omitting certain portions of the message from the stored output.</p> 1444 <p>The <b>discard</b> and <b>ignore</b> commands are not inverses of the <b>retain</b> command. The <b>retain</b> command discards 1445 all header fields except those explicitly retained. The <b>discard</b> command keeps all header fields except those explicitly 1446 discarded. If field names exist on the retained field names list, <b>discard</b> and <b>ignore</b> commands are ignored.</p> 1447 </blockquote> 1448 <h4 class="mansect"><a name="tag_20_75_17" id="tag_20_75_17"></a>EXAMPLES</h4> 1449 <blockquote> 1450 <p>None.</p> 1451 </blockquote> 1452 <h4 class="mansect"><a name="tag_20_75_18" id="tag_20_75_18"></a>RATIONALE</h4> 1453 <blockquote> 1454 <p>The standard developers felt strongly that a method for applications to send messages to specific users was necessary. The 1455 obvious example is a batch utility, running non-interactively, that wishes to communicate errors or results to a user. However, the 1456 actual format, delivery mechanism, and method of reading the message are clearly beyond the scope of this volume of 1457 POSIX.1-2024.</p> 1458 <p>The intent of this command is to provide a simple, portable interface for sending messages non-interactively. It merely defines 1459 a "front-end" to the historical mail system. It is suggested that implementations explicitly denote the sender and recipient in 1460 the body of the delivered message. Further specification of formats for either the message envelope or the message itself were 1461 deliberately not made, as the industry is in the midst of changing from the current standards to a more internationalized standard 1462 and it is probably incorrect, at this time, to require either one.</p> 1463 <p>Implementations are encouraged to conform to the various delivery mechanisms described in the CCITT X.400 standards or to the 1464 equivalent Internet standards, described in Internet Request for Comment (RFC) documents RFC 819, RFC 920, RFC 921, 1465 RFC 1123, and RFC 5322.</p> 1466 <p>Many historical systems modified each body line that started with <b>From </b> by prefixing the <tt>'F'</tt> with 1467 <tt>'>'</tt>. It is unnecessary, but allowed, to do that when the string does not follow a blank line because it cannot be 1468 confused with the next header.</p> 1469 <p>The <b>edit</b> and <b>visual</b> commands merely edit the specified messages in a temporary file. They do not modify the 1470 contents of those messages in the mailbox; such a capability could be added as an extension, such as by using different command 1471 names.</p> 1472 <p>The restriction on the value for a <b>Subject</b> header field being {LINE_MAX}-10 bytes is based on the historical format that 1473 consumes 10 bytes for <b>Subject: </b> and the trailing <newline>. Many historical mailers that a message may encounter 1474 on other systems are not able to handle lines that long, however.</p> 1475 <p>Like the utilities <a href="../utilities/logger.html"><i>logger</i></a> and <a href="../utilities/lp.html"><i>lp</i></a>, 1476 <i>mailx</i> admittedly is difficult to test. This was not deemed sufficient justification to exclude this utility from this volume 1477 of POSIX.1-2024. It is also arguable that it is, in fact, testable, but that the tests themselves are not portable.</p> 1478 <p>When <i>mailx</i> is being used by an application that wishes to receive the results as if none of the User Portability 1479 Utilities option features were supported, the <i>DEAD</i> environment variable must be set to <b>/dev/null</b>. Otherwise, it may 1480 be subject to the file creations described in <i>mailx</i> ASYNCHRONOUS EVENTS. Similarly, if the <i>MAILRC</i> environment 1481 variable is not set to <b>/dev/null</b>, historical versions of <i>mailx</i> and <i>Mail</i> read initialization commands from a 1482 file before processing begins. Since the initialization that a user specifies could alter the contents of messages an application 1483 is trying to send, such applications must set <i>MAILRC</i> to <b>/dev/null</b>.</p> 1484 <p>The description of <i>LC_TIME</i> uses "may affect" because many historical implementations do not or cannot manipulate the 1485 date and time strings in the incoming mail headers. Some header fields found in incoming mail do not have enough information to 1486 determine the timezone in which the mail originated, and, therefore, <i>mailx</i> cannot convert the date and time strings into the 1487 internal form that then is parsed by routines like <a href="../functions/strftime.html"><i>strftime</i>()</a> that can take 1488 <i>LC_TIME</i> settings into account. Changing all these times to a user-specified format is allowed, but not required.</p> 1489 <p>The paginator selected when <i>PAGER</i> is null or unset is partially unspecified to allow the System V historical practice of 1490 using <i>pg</i> as the default. Bypassing the pagination function, such as by declaring that <a href= 1491 "../utilities/cat.html"><i>cat</i></a> is the paginator, would not meet with the intended meaning of this description. However, any 1492 "portable user" would have to set <i>PAGER</i> explicitly to get his or her preferred paginator on all systems. The paginator 1493 choice was made partially unspecified, unlike the <i>VISUAL</i> editor choice (mandated to be <a href= 1494 "../utilities/vi.html"><i>vi</i></a>) because most historical pagers follow a common theme of user input, whereas editors differ 1495 dramatically.</p> 1496 <p>Options to specify addresses as <b>cc</b> (carbon copy) or <b>bcc</b> (blind carbon copy) were considered to be format details 1497 and were omitted.</p> 1498 <p>A zero exit status implies that all messages were <i>sent</i>, but it gives no assurances that any of them were actually 1499 <i>delivered</i>. The reliability of the delivery mechanism is unspecified and is an appropriate marketing distinction between 1500 systems.</p> 1501 <p>In order to conform to the Utility Syntax Guidelines, a solution was required to the optional <i>file</i> option-argument to 1502 <b>-f</b>. By making <i>file</i> an operand, the guidelines are satisfied and users remain portable. However, it does force 1503 implementations to support usage such as:</p> 1504 <pre> 1505 <tt>mailx -fin mymail.box 1506 </tt></pre> 1507 <p>The <b>no</b> <i>name</i> method of unsetting variables is not present in all historical systems, but it is in System V and 1508 provides a logical set of commands corresponding to the format of the display of options from the <i>mailx</i> <a href= 1509 "../utilities/V3_chap02.html#set"><i>set</i></a> command without arguments.</p> 1510 <p>The <b>ask</b> and <b>asksub</b> variables are the names selected by BSD and System V, respectively, for the same feature. They 1511 are synonyms in this volume of POSIX.1-2024.</p> 1512 <p>The <i>mailx</i> <a href="../utilities/echo.html"><i>echo</i></a> command was not documented in the BSD version and has been 1513 omitted here because it is not obviously useful for interactive users.</p> 1514 <p>The default prompt on the System V <i>mailx</i> is a <question-mark>, on BSD <i>Mail</i> an <ampersand>. Since this 1515 volume of POSIX.1-2024 chose the <i>mailx</i> name, it kept the System V default, assuming that BSD users would not have difficulty 1516 with this minor incompatibility (that they can override).</p> 1517 <p>The meanings of <b>r</b> and <b>R</b> are reversed between System V <i>mailx</i> and SunOS <i>Mail</i>. Once again, since this 1518 volume of POSIX.1-2024 chose the <i>mailx</i> name, it kept the System V default, but allows the SunOS user to achieve the desired 1519 results using <b>flipr</b>, an internal variable in System V <i>mailx</i>, although it has not been documented in the SVID.</p> 1520 <p>The <b>indentprefix</b> variable, the <b>retain</b> and <b>unalias</b> commands, and the <b>~F</b> and <b>~M</b> command escapes 1521 were adopted from 4.3 BSD <i>Mail</i>.</p> 1522 <p>The <b>version</b> command was not included because no sufficiently general specification of the version information could be 1523 devised that would still be useful to a portable user. This command name should be used by suppliers who wish to provide version 1524 information about the <i>mailx</i> command.</p> 1525 <p>The "implementation-specific (unspecified) system start-up file" historically has been named <b>/etc/mailx.rc</b>, but this 1526 specific name and location are not required.</p> 1527 <p>The intent of the wording for the <b>next</b> command is that if any command has already displayed the current message it should 1528 display a following message, but, otherwise, it should display the current message. Consider the command sequence:</p> 1529 <pre> 1530 <tt>next 3 1531 delete 3 1532 next 1533 </tt></pre> 1534 <p>where the <b>autoprint</b> option was not set. The normative text specifies that the second <b>next</b> command should display a 1535 message following the third message, because even though the current message has not been displayed since it was set by the 1536 <b>delete</b> command, it has been displayed since the current message was anything other than message number 3. This does not 1537 always match historical practice in some implementations, where the command file address followed by <b>next</b> (or the default 1538 command) would skip the message for which the user had searched.</p> 1539 </blockquote> 1540 <h4 class="mansect"><a name="tag_20_75_19" id="tag_20_75_19"></a>FUTURE DIRECTIONS</h4> 1541 <blockquote> 1542 <p>If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of a 1543 <newline> character, implementations are encouraged to treat this as an error. A future version of this standard may require 1544 implementations to treat this as an error.</p> 1545 </blockquote> 1546 <h4 class="mansect"><a name="tag_20_75_20" id="tag_20_75_20"></a>SEE ALSO</h4> 1547 <blockquote> 1548 <p><a href="../utilities/V3_chap02.html#tag_19"><i>2. Shell Command Language</i></a> , <a href= 1549 "../utilities/ed.html#"><i>ed</i></a> , <a href="../utilities/ls.html#"><i>ls</i></a> , <a href= 1550 "../utilities/more.html#"><i>more</i></a> , <a href="../utilities/vi.html#"><i>vi</i></a></p> 1551 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 1552 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 1553 </blockquote> 1554 <h4 class="mansect"><a name="tag_20_75_21" id="tag_20_75_21"></a>CHANGE HISTORY</h4> 1555 <blockquote> 1556 <p>First released in Issue 2.</p> 1557 </blockquote> 1558 <h4 class="mansect"><a name="tag_20_75_22" id="tag_20_75_22"></a>Issue 5</h4> 1559 <blockquote> 1560 <p>The description of the <i>EDITOR</i> environment variable is changed to indicate that <a href= 1561 "../utilities/ed.html"><i>ed</i></a> is the default editor if this variable is not set. In previous issues, this default was not 1562 stated explicitly at this point but was implied further down in the text.</p> 1563 <p>The FUTURE DIRECTIONS section is added.</p> 1564 </blockquote> 1565 <h4 class="mansect"><a name="tag_20_75_23" id="tag_20_75_23"></a>Issue 6</h4> 1566 <blockquote> 1567 <p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p> 1568 <ul> 1569 <li> 1570 <p>The <b>-F</b> option is added.</p> 1571 </li> 1572 <li> 1573 <p>The <b>allnet</b>, <b>debug</b>, and <b>sendwait</b> internal variables are added.</p> 1574 </li> 1575 <li> 1576 <p>The <b>C</b>, <b>ec</b>, <b>fo</b>, <b>F</b>, and <b>S</b> <i>mailx</i> commands are added.</p> 1577 </li> 1578 </ul> 1579 <p>In the DESCRIPTION and ENVIRONMENT VARIABLES sections, text stating "<i>HOME</i> directory" is replaced by "directory 1580 referred to by the <i>HOME</i> environment variable".</p> 1581 <p>The <i>mailx</i> utility is aligned with the IEEE P1003.2b draft standard, which includes various clarifications to resolve 1582 IEEE PASC Interpretations submitted for the ISO POSIX-2:1993 standard. In particular, the changes here address IEEE PASC 1583 Interpretations 1003.2 #10, #11, #103, #106, #108, #114, #115, #122, and #129.</p> 1584 <p>The normative text is reworded to avoid use of the term "must" for application requirements.</p> 1585 <p>The <i>TZ</i> entry is added to the ENVIRONMENT VARIABLES section.</p> 1586 <p>IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/32 is applied, applying a change to the EXTENDED DESCRIPTION, 1587 raised by IEEE PASC Interpretation 1003.2 #122, which was overlooked in the first version of this standard.</p> 1588 <p>IEEE Std 1003.1-2001/Cor 2-2004, item XCU/TC2/D6/17 is applied, updating the EXTENDED DESCRIPTION (Internal 1589 Variables in <i>mailx</i>). The system start-up file is changed from "implementation-defined" to "unspecified" for consistency 1590 with other text in the EXTENDED DESCRIPTION.</p> 1591 </blockquote> 1592 <h4 class="mansect"><a name="tag_20_75_24" id="tag_20_75_24"></a>Issue 7</h4> 1593 <blockquote> 1594 <p>Austin Group Interpretation 1003.1-2001 #089 is applied, clarifying the effect of the <i>LC_TIME</i> environment variable.</p> 1595 <p>Austin Group Interpretation 1003.1-2001 #090 is applied, updating the description of the <b>next</b> command.</p> 1596 <p>SD5-XCU-ERN-69 is applied.</p> 1597 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 1598 <p>Shading to indicate support for the User Portability Utilities option is added.</p> 1599 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0120 [855] and XCU/TC2-2008/0121 [619] are applied.</p> 1600 </blockquote> 1601 <h4 class="mansect"><a name="tag_20_75_25" id="tag_20_75_25"></a>Issue 8</h4> 1602 <blockquote> 1603 <p>Austin Group Defect 251 is applied, encouraging implementations to disallow the creation of filenames containing any bytes that 1604 have the encoded value of a <newline> character.</p> 1605 <p>Austin Group Defect 956 is applied, clarifying how the <i>PAGER</i> environment variable and the <b>crt</b> internal variable 1606 affect pagination.</p> 1607 <p>Austin Group Defects 990 and 991 are applied, changing the description of the <b>mbox</b> command.</p> 1608 <p>Austin Group Defect 999 is applied, adding <b>Save</b> to the list of commands that are invalid in a start-up file.</p> 1609 <p>Austin Group Defect 1034 is applied, clarifying that <b>~.</b> can be used to terminate input mode when <b>ignoreeof</b> is 1610 set.</p> 1611 <p>Austin Group Defect 1109 is applied, changing the description of the <b>bang</b> internal variable.</p> 1612 <p>Austin Group Defect 1113 is applied, changing the description of the <i>read</i> state.</p> 1613 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 1614 <p>Austin Group Defect 1176 is applied, changing "option-argument" to "operand".</p> 1615 <p>Austin Group Defect 1306 is applied, changing the description of the <b>folder</b> internal variable.</p> 1616 <p>Austin Group Defect 1367 is applied, adding the <b>-E</b> option.</p> 1617 <p>Austin Group Defect 1401 is applied, changing the requirements for the <b>reply</b>, <b>Reply</b>, <b>followup</b>, and 1618 <b>Followup</b> commands.</p> 1619 <p>Austin Group Defect 1405 is applied, changing the terminology related to mail messages to match IETF RFC 5322.</p> 1620 <p>Austin Group Defect 1408 is applied, changing the description of Send Mode.</p> 1621 <p>Austin Group Defect 1507 is applied, changing the EXIT STATUS section.</p> 1622 <p>Austin Group Defect 1528 is applied, adding a <tt>"--"</tt> argument to be passed between <tt>"-c"</tt> and <i>command</i> when 1623 executing shell commands.</p> 1624 <p>Austin Group Defect 1634 is applied, clarifying handling of the system mailbox.</p> 1625 <p>Austin Group Defect 1685 is applied, updating RFC references.</p> 1626 <p>Austin Group Defect 1725 is applied, clarifying that the default for the <b>screen</b> internal variable is <b>noscreen</b>.</p> 1627 <p>Austin Group Defect 1743 is applied, changing the descriptions of the <b>metoo</b> internal variable and the <b>alternates</b> 1628 command.</p> 1629 <p>Austin Group Defect 1747 is applied, changing the description of the <b>alias</b> command.</p> 1630 </blockquote> 1631 <div class="box"><em>End of informative text.</em></div> 1632 <hr> 1633 <p> </p> 1634 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 1635 <hr size="2" noshade> 1636 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 1637 POSIX™ is a Trademark of The IEEE.<br> 1638 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 1639 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 1640 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 1641 ]</font></center> 1642 <hr size="2" noshade> 1643 <div class="NAVHEADER"> 1644 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 1645 <tr class="nav"> 1646 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/m4.html" accesskey="P"><<< 1647 Previous</a></td> 1648 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 1649 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/make.html" accesskey="N">Next >>></a></td> 1650 </tr> 1651 </table> 1652 <hr align="left" width="100%"></div> 1653 </body> 1654 </html>