Command-Line Definitions
Macros may also be declared when sendmail processes its command line, by using either the -M
command-line switch or the M
option (see ). The forms for these command-line declarations are
-oMXtext
no longer recommended -M
Xtext
preferred as of V8.7
For both forms, the X
is the macro name, which can be single-character or multicharacter (we discuss this soon). The text
follows the name and is the value assigned to the macro.
In the first form, the -o
switch tells sendmail that this is an option. The M
is the name of the option. The M
option causes sendmail to use the characters that follow the M
as a macro definition. This form still works but may be eliminated in a future version of sendmail.
In the second form, the -M
command line switch causes sendmail to use the characters that follow the M
as a macro definition. Beginning with V8.7 sendmail, this is now the preferred form.
Because these forms of definition are a part of the command line, all special characters are interpreted by the shell. Any text
that contains shell wildcard or history characters should be quoted. (We'll cover this in detail soon.)
Command-line macros are defined before the configuration file is read and parsed by sendmail. Note that configuration-file macros always override command-line macros. [3] Despite this, command-line definitions may still be useful. Preassigned macros may be given new values, and user-defined macros may be initialized in the command line.
[3] If you are running a pre-V8 version of sendmail, it may use a freeze file. In that case, command-line macros override those in the configuration file.
For security reasons, only the r
and s
macros [4] allow sendmail to retain its root privilege. Overriding the value of any other macro from the command line causes sendmail to run as an ordinary user.
[4] For V8 sendmail,
r
ands
should be set with the-p
command-line switch (see -p).
Syntax of the Command-Line Macro's Text
When a macro is declared on the command line, its text
value is taken from the command line as is:
-MXtext
-oMXtext
Unlike macros declared in the configuration file (which we describe next), this form of declaration does not strip commas from text
nor does it handle escape characters.
The whole suite of special operators available to your shell may be used to generate an appropriate text
value. For example, the following assigns the name of your Usenet news server to the macro N
:
-MN$NNTPSERVER
The $NNTPSERVER
is the shell's environmental variable that contains the address of the news server as its value.