/usr/share/doc/mailutils-doc/mailutils.html/Scripting.html is in mailutils-doc 1:2.99.99-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Published by the Free Software Foundation,
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA
Copyright (C) 1999-2004, 2008-2012, 2014-2015 Free Software
Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover, and no Back-Cover texts.
A copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<!-- Created by GNU Texinfo 6.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Mailutils Manual: Scripting</title>
<meta name="description" content="GNU Mailutils Manual: Scripting">
<meta name="keywords" content="GNU Mailutils Manual: Scripting">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-Index.html#Function-Index" rel="index" title="Function Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="mail.html#mail" rel="up" title="mail">
<link href="Mail-Variables.html#Mail-Variables" rel="next" title="Mail Variables">
<link href="Shell-Escapes.html#Shell-Escapes" rel="prev" title="Shell Escapes">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Scripting"></a>
<div class="header">
<p>
Next: <a href="Mail-Variables.html#Mail-Variables" accesskey="n" rel="next">Mail Variables</a>, Previous: <a href="Reading-Mail.html#Reading-Mail" accesskey="p" rel="prev">Reading Mail</a>, Up: <a href="mail.html#mail" accesskey="u" rel="up">mail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Scripting-1"></a>
<h4 class="subsection">2.5.5 Scripting</h4>
<a name="Comments-2"></a>
<h4 class="subsubheading">Comments</h4>
<p>The ‘<samp>#</samp>’ character introduces an end-of-line comment. All characters
until and including the end of line are ignored.
</p>
<a name="Displaying-Arbitrary-Text"></a>
<h4 class="subsubheading">Displaying Arbitrary Text</h4>
<a name="index-echo_002c-mail-command"></a>
<p>The ‘<samp>echo</samp>’ (‘<samp>ec</samp>’) command prints its arguments to stdout.
</p>
<a name="Sourcing-External-Command-Files"></a>
<h4 class="subsubheading">Sourcing External Command Files</h4>
<a name="index-source_002c-mail-command"></a>
<p>The command ‘<samp>source <var>filename</var></samp>’ reads commands from the named
file. Its minimal abbreviation is ‘<samp>so</samp>’.
</p>
<a name="Setting-and-Unsetting-the-Variables"></a><a name="Setting-and-Unsetting-the-Variables-1"></a>
<h4 class="subsubheading">Setting and Unsetting the Variables</h4>
<a name="index-set_002c-mail-command"></a>
<a name="index-unset_002c-mail-command"></a>
<p>The mail variables are set using ‘<samp>set</samp>’ (‘<samp>se</samp>’) command. The
command takes a list of assignments. The syntax of an assignment is
</p>
<dl compact="compact">
<dt>‘<samp><var>name</var>=<var>string</var></samp>’</dt>
<dd><p>Assign a string value to the variable. If <var>string</var> contains
whitespace characters it must be enclosed in a pair of
double-quote characters (‘<samp>"</samp>’)
</p></dd>
<dt>‘<samp><var>name</var>=<var>number</var></samp>’</dt>
<dd><p>Assign a numeric value to the variable.
</p></dd>
<dt>‘<samp><var>name</var></samp>’</dt>
<dd><p>Assign boolean <code>True</code> value.
</p></dd>
<dt>‘<samp>no<var>name</var></samp>’</dt>
<dd><p>Assign boolean <code>False</code> value.
</p></dd>
</dl>
<p>Example:
</p>
<div class="example">
<pre class="example">& set askcc nocrt indentprefix="> "
</pre></div>
<p>This statement sets <code>askcc</code> to <code>True</code>, <code>crt</code> to
<code>False</code>, and <code>indentprefix</code> to “> ”.
</p>
<p>To unset mail variables use ‘<samp>unset</samp>’(‘<samp>uns</samp>’) command. The
command takes a list of variable names to unset.
</p>
<p>Example:
To undo the effect of the previous example, do:
</p>
<div class="example">
<pre class="example">& unset askcc crt indentprefix
</pre></div>
<p>When used without arguments, both <code>set</code> or <code>unset</code>
list all currently defined variables. The form of this listing is
controlled by <code>variable-pretty-print</code> (<code>varpp</code>) variable. If
it is set, a description precedes each variable, e.g.:
</p>
<div class="example">
<pre class="example"># prompt user for subject before composing the message
ask
# prompt user for cc before composing the message
askcc
# output character set for decoded header fields
charset="auto"
# number of columns on terminal screen
columns=80
</pre></div>
<p>If <code>variable-pretty-print</code> is not set, only the settings are
shown, e.g.:
</p>
<div class="example">
<pre class="example">ask
askcc
charset="auto"
columns=80
</pre></div>
<a name="index-variable_002c-mail-command"></a>
<p>A special command is provided to list all internal <code>mail</code>
variables:
</p>
<div class="example">
<pre class="example">variable [<var>names...</var>]
</pre></div>
<p>If used without arguments, it prints all known internal variables. If
arguments are given, it displays only those internal variables that
are listed in command line. For each variable, this command prints its
name, data type, current value and a short description. For example:
</p>
<div class="example">
<pre class="example">& variable ask datefield
ask, asksub
Type: boolean
Current value: yes
prompt user for subject before composing the message
datefield
Type: boolean
Current value: [not set]
get date from the `Date:' header, instead of the envelope
</pre></div>
<a name="Setting-and-Unsetting-Shell-Environment-Variables"></a>
<h4 class="subsubheading">Setting and Unsetting Shell Environment Variables</h4>
<p>Shell environment may be modified using ‘<samp>setenv</samp>’ (‘<samp>sete</samp>’)
command. The command takes a list of assignments. The syntax of an
assignment is:
</p>
<dl compact="compact">
<dt>‘<samp><var>name</var>=<var>value</var></samp>’</dt>
<dd><p>If variable <var>name</var> does not already exist in the environment,
then it is added to the environment with the value <var>value</var>.
If <var>name</var> does exist, then its value in the environment is
changed to <var>value</var>.
</p></dd>
<dt>‘<samp><var>name</var></samp>’</dt>
<dd><p>Delete the variable <var>name</var> from the environment (“unset” it).
</p></dd>
</dl>
<a name="Conditional-Statements"></a>
<h4 class="subsubheading">Conditional Statements</h4>
<a name="index-if_002c-mail-command"></a>
<a name="index-else_002c-mail-command"></a>
<a name="index-endif_002c-mail-command"></a>
<p>The conditional statement allows to execute a set of mail commands
depending on the mode the <code>mail</code> program is in. The conditional
statement is:
</p>
<div class="example">
<pre class="example">if <var>cond</var>
...
else
...
endif
</pre></div>
<p>where ‘<samp>...</samp>’ represents the set of commands to be executed in each
branch of the statement. <var>cond</var> can be one of the following:
</p>
<dl compact="compact">
<dt>‘<samp>s</samp>’</dt>
<dd><p>True if <code>mail</code> is operating in mail sending mode.
</p></dd>
<dt>‘<samp>r</samp>’</dt>
<dd><p>True if <code>mail</code> is operating in mail reading mode.
</p></dd>
<dt>‘<samp>t</samp>’</dt>
<dd><p>True if stdout is a terminal device (as opposed to a regular file).
</p></dd>
</dl>
<p>The conditional statements can be nested to arbitrary depth. The minimal
abbreviations for ‘<samp>if</samp>’, ‘<samp>else</samp>’ and ‘<samp>endif</samp>’ commands are
‘<samp>i</samp>’, ‘<samp>el</samp>’ and ‘<samp>en</samp>’.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">if t
set crt prompt="& "
else
unset prompt
endif
if s
alt gray@farlep.net gray@mirddin.farlep.net
set
</pre></div>
<hr>
<div class="header">
<p>
Next: <a href="Mail-Variables.html#Mail-Variables" accesskey="n" rel="next">Mail Variables</a>, Previous: <a href="Reading-Mail.html#Reading-Mail" accesskey="p" rel="prev">Reading Mail</a>, Up: <a href="mail.html#mail" accesskey="u" rel="up">mail</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|