📄 mailx.html
字号:
<p>In both cases listed in item b, if the message is not empty:</p><ol type="i"><li><p>If <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 .</i> If the file exists, the message shall be written to replace the contents of the file.</p></li><li><p>If <b>save</b> is not enabled, or the file named by <i>DEAD</i> cannot be created, the message shall not be saved.</p></li></ol></li></ol></li></ol><p>The <i>mailx</i> utility shall take the standard action for all other signals.</p></blockquote><h4><a name="tag_04_83_10"></a>STDOUT</h4><blockquote><p>In command and input modes, all output, including prompts and messages, shall be written to standard output.</p></blockquote><h4><a name="tag_04_83_11"></a>STDERR</h4><blockquote><p>The standard error shall be used only for diagnostic messages.</p></blockquote><h4><a name="tag_04_83_12"></a>OUTPUT FILES</h4><blockquote><p>Various <i>mailx</i> commands and command escapes can create or add to files, including the <b>mbox</b>, the dead-letter file,and secondary mailboxes. When <i>mailx</i> is used as described in this volume of IEEE Std 1003.1-2001, these files shallbe text files, formatted as follows:</p><blockquote><tt>line beginning with</tt> <b>From<space><br> [</b><tt>one or more</tt> <i>header-lines</i>; see <a href="#tag_04_83_13_03">Commands in mailx</a> <b>]<br></b> <i>empty line<br></i> <b>[</b><tt>zero or more</tt> <i>body lines<br> empty line</i><b>]<br> [</b><tt>line beginning with</tt> <b>From<space>...]</b></blockquote><p>where each message begins with the <b>From <space></b> line shown, preceded by the beginning of the file or an emptyline. (The <b>From <space></b> line is considered to be part of the message header, but not one of the header-lines referredto in <a href="#tag_04_83_13_03">Commands in mailx</a>; thus, it shall not be affected by the <b>discard</b>, <b>ignore</b>, or<b>retain</b> commands.) The formats of the remainder of the <b>From <space></b> line and any additional header lines areunspecified, except that none shall be empty. The format of a message body line is also unspecified, except that no line followingan empty line shall start with <b>From <space></b>; <i>mailx</i> shall modify any such user-entered message body lines(following an empty line and beginning with <b>From <space></b>) by adding one or more characters to precede the <tt>'F'</tt>; it may add these characters to <b>From <space></b> lines that are not preceded by an empty line.</p><p>When a message from the system mailbox or entered by the user is not a text file, it is implementation-defined how such amessage is stored in files written by <i>mailx</i>.</p></blockquote><h4><a name="tag_04_83_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>The entire EXTENDED DESCRIPTION section shall apply only to implementations supporting the User Portability Utilitiesoption.</p><p>The <i>mailx</i> utility cannot guarantee support for all character encodings in all circumstances. For example, inter-systemmail may be restricted to 7-bit data by the underlying network, 8-bit data need not be portable to non-internationalized systems,and so on. Under these circumstances, it is recommended that only characters defined in the ISO/IEC 646:1991 standardInternational Reference Version (equivalent to ASCII) 7-bit range of characters be used.</p><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<b>-N</b> was not specified and there are messages, see below), followed by a prompt indicating that <i>mailx</i> can acceptregular commands (see <a href="#tag_04_83_13_03">Commands in mailx</a>); this is termed <i>command mode</i>. The page ofheader-summary lines shall contain the first new message if there are new messages, or the first unread message if there are unreadmessages, or the first message. When <i>mailx</i> is invoked using the Send Mode synopsis and standard input is a terminal, if nosubject is specified on the command line and the <b>asksub</b> variable is set, a prompt for the subject shall be written. At thispoint, <i>mailx</i> shall be in input mode. This input mode shall also be entered when using one of the Receive Mode synopsis formsand 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>commands and standard input is a terminal. When the message is typed and the end of the message is encountered, the message shallbe passed to the mail delivery software. Commands can be entered by beginning a line with the escape character (by default, tilde (<tt>'˜'</tt> )) followed by a single command letter and optional arguments. See <a href="#tag_04_83_13_03">Commands inmailx</a> for a summary of these commands. It is unspecified what effect these commands will have if standard input is not aterminal when a message is entered using either the Send Mode synopsis, or the Read Mode commands <b>reply</b>, <b>Reply</b>,<b>followup</b>, <b>Followup</b>, or <b>mail</b>. <basefont size="2"></p><dl><dt><b>Note:</b></dt><dd>For notational convenience, this section uses the default escape character, tilde, in all references and examples.</dd></dl><basefont size="3"> <p>At any time, the behavior of <i>mailx</i> shall be governed by a set of environmental and internal variables. These are flagsand valued parameters that can be set and cleared via the <i>mailx</i> <b>set</b> and <b>unset</b> commands.</p><p>Regular commands are of the form:</p><pre><b>[</b><i>command</i><b>] [</b><i>msglist</i><b>] [</b><i>argument</i> <tt>...</tt><b>]</b></pre><p>If no <i>command</i> is specified in command mode, <b>next</b> shall be assumed. In input mode, commands shall be recognized bythe escape character, and lines not treated as commands shall be taken as input for the message.</p><p>In command mode, each message shall be assigned a sequential number, starting with 1.</p><p>All messages have a state that shall affect how they are displayed in the header summary and how they are retained or deletedupon termination of <i>mailx</i>. There is at any time the notion of a <i>current</i> message, which shall be marked by a<tt>'>'</tt> at the beginning of a line in the header summary. When <i>mailx</i> is invoked using one of the Receive Modesynopsis forms, the current message shall be the first new message, if there is a new message, or the first unread message if thereis an unread message, or the first message if there are any messages, or unspecified if there are no messages in the mailbox. Eachcommand that takes an optional list of messages (<i>msglist</i>) or an optional single message (<i>message</i>) on which to operateshall leave the current message set to the highest-numbered message of the messages specified, unless the command deletes messages,in which case the current message shall be set to the first undeleted message (that is, a message not in the deleted state) afterthe highest-numbered message deleted by the command, if one exists, or the first undeleted message before the highest-numberedmessage deleted by the command, if one exists, or to an unspecified value if there are no remaining undeleted messages. Allmessages shall be in one of the following states:</p><dl compact><dt><i>new</i></dt><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<i>new</i> when <i>mailx</i> quits shall be retained in the system mailbox.</dd><dt><i>unread</i></dt><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 theuser or moved to any other state. Messages in state <i>unread</i> when <i>mailx</i> quits shall be retained in the systemmailbox.</dd><dt><i>read</i></dt><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>, <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 <b>delete</b>, <b>dp</b>, and <b>dt</b> commands may also cause the next message to be marked as<i>read</i>, depending on the value of the <b>autoprint</b> variable. Messages that are in the system mailbox and in state<i>read</i> when <i>mailx</i> quits shall be saved in the <b>mbox</b>, unless the internal variable <b>hold</b> was set. Messagesthat are in the <b>mbox</b> or in a secondary mailbox and in state <i>read</i> when <i>mailx</i> quits shall be retained in theircurrent location.</dd><dt><i>deleted</i></dt><dd>The message has been processed by one of the following commands: <b>delete</b>, <b>dp</b>, <b>dt</b>. Messages in state<i>deleted</i> when <i>mailx</i> quits shall be deleted. Deleted messages shall be ignored until <i>mailx</i> quits or changesmailboxes or they are specified to the undelete command; for example, the message specification / <i>string</i> shall only searchthe subject lines of messages that have not yet been deleted, unless the command operating on the list of messages is<b>undelete</b>. No deleted message or deleted message header shall be displayed by any <i>mailx</i> command other than<b>undelete</b>.</dd><dt><i>preserved</i></dt><dd>The message has been processed by a <b>preserve</b> command. When <i>mailx</i> quits, the message shall be retained in itscurrent location.</dd><dt><i>saved</i></dt><dd>The message has been processed by one of the following commands: <b>save</b> or <b>write</b>. If the current mailbox is thesystem mailbox, and the internal variable <b>keepsave</b> is set, messages in the state saved shall be saved to the file designatedby the <i>MBOX</i> variable (see the ENVIRONMENT VARIABLES section). If the current mailbox is the system mailbox, messages in thestate <i>saved</i> shall be deleted from the current mailbox, when the <b>quit</b> or <b>file</b> command is used to exit thecurrent mailbox.</dd></dl><p>The header-summary line for each message shall indicate the state of the message.</p><p>Many commands take an optional list of messages ( <i>msglist</i>) on which to operate, which defaults to the current message. A<i>msglist</i> is a list of message specifications separated by <blank>s, which can include:</p><dl compact><dt><tt>n</tt></dt><dd>Message number <i>n</i>.</dd><dt><tt>+</tt></dt><dd>The next undeleted message, or the next deleted message for the <b>undelete</b> command.</dd><dt><tt>-</tt></dt><dd>The next previous undeleted message, or the next previous deleted message for the <b>undelete</b> command.</dd><dt><tt>.</tt></dt><dd>The current message.</dd><dt><tt>^</tt></dt><dd>The first undeleted message, or the first deleted message for the <b>undelete</b> command.</dd><dt><tt>$</tt></dt><dd>The last message.</dd><dt><tt>*</tt></dt><dd>All messages.</dd><dt><tt>n-m</tt></dt><dd>An inclusive range of message numbers.</dd><dt><i>address</i></dt><dd>All messages from <i>address</i>; any address as shown in a header summary shall be matchable in this form.</dd><dt>/<i>string</i></dt><dd>All messages with <i>string</i> in the subject line (case ignored).</dd><dt><tt>:c</tt></dt><dd>All messages of type <i>c</i>, where <i>c</i> shall be one of: <dl compact><dt><tt>d</tt></dt><dd>Deleted messages.</dd><dt><tt>n</tt></dt><dd>New messages.</dd><dt><tt>o</tt></dt><dd>Old messages (any not in state <i>read</i> or <i>new</i>).</dd><dt><tt>r</tt></dt><dd>Read messages.</dd><dt><tt>u</tt></dt><dd>Unread messages.</dd></dl></dd></dl><p>Other commands take an optional message ( <i>message</i>) on which to operate, which defaults to the current message. All of theforms allowed for <i>msglist</i> are also allowed for <i>message</i>, but if more than one message is specified, only the firstshall be operated on.</p><p>Other arguments are usually arbitrary strings whose usage depends on the command involved.</p><h5><a name="tag_04_83_13_01"></a>Start-Up in mailx</h5><p>At start-up time, <i>mailx</i> shall take the following steps in sequence:</p><ol><li><p>Establish all variables at their stated default values.</p></li><li><p>Process command line options, overriding corresponding default values.</p></li><li><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>variables that are present in the environment, overriding the corresponding default values.</p></li><li><p>Read <i>mailx</i> commands from an unspecified system start-up file, unless the <b>-n</b> option is given, to initialize anyinternal <i>mailx</i> variables and aliases.</p></li><li><p>Process the start-up file of <i>mailx</i> commands named in the user <i>MAILRC</i> variable.</p></li></ol><p>Most regular <i>mailx</i> commands are valid inside start-up files, the most common use being to set up initial display optionsand alias lists. The following commands shall be invalid in the start-up file: <b>!</b>, <b>edit</b>, <b>hold</b>, <b>mail</b>,<b>preserve</b>, <b>reply</b>, <b>Reply</b>, <b>shell</b>, <b>visual</b>, <b>Copy</b>, <b>followup</b>, and <b>Followup</b>. Anyerrors in the start-up file shall either cause <i>mailx</i> to terminate with a diagnostic message and a non-zero status or tocontinue after writing a diagnostic message, ignoring the remainder of the lines in the start-up file.</p><p>A blank line in a start-up file shall be ignored.</p><h5><a name="tag_04_83_13_02"></a>Internal Variables in mailx</h5><p>The following variables are internal <i>mailx</i> variables. Each internal variable can be set via the <i>mailx</i> <b>set</b>command at any time. The <b>unset</b> and <b>set no</b> <i>name</i> commands can be used to erase variables.</p><p>In the following list, variables shown as:</p><pre><tt>variable</tt></pre><p>represent Boolean values. Variables shown as:</p><pre><tt>variable=</tt><i>value</i></pre><p>shall be assigned string or numeric values. For string values, the rules in <a href="#tag_04_83_13_03">Commands in mailx</a>concerning filenames and quoting shall also apply.</p><p>The defaults specified here may be changed by the unspecified system start-up file unless the user specifies the <b>-n</b>option.</p><dl compact><dt><b>allnet</b></dt><dd>All network names whose login name components match shall be treated as identical. This shall cause the <i>msglist</i> messagespecifications to behave similarly. The default shall be <b>noallnet</b>. See also the <b>alternates</b> command and the<b>metoo</b> variable.</dd><dt><b>append</b></dt><dd>Append messages to the end of the <b>mbox</b> file upon termination instead of placing them at the beginning. The default shallbe <b>noappend</b>. This variable shall not affect the <b>save</b> command when saving to <b>mbox</b>.</dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -