home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

21.2 Command-Line Definitions

Defined sendmail macros can also be declared when sendmail processes its command line, by using either the -M command-line switch or the M option (M). The forms for these command-line declarations are:

-oMXtext              no longer recommended 
-MXtext               preferred as of V8.7 

For both forms, the X is the sendmail 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 might 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 have each of those special characters prefixed with a backslash:

-MXsurprise!me   /! is special for the C shell

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. Despite this, command-line definitions can still be useful. Preassigned macros can be given new values, and user-defined macros can be initialized in the command line.

For security reasons, only the r and s macros[3] allow sendmail to retain any special privilege. Overriding the value of any other macro from the command line causes sendmail to give up that special privilege.

[3] For V8 sendmail, r and s should be set with the -p command-line switch (-p).

21.2.1 Syntax of the Command-Line Macro's Text

When a sendmail macro is declared on the command line, its text value is taken from the command line as is:

-oMXtext     obsolete 
-MXtext

Unlike sendmail macros declared in the configuration file (which we describe next), command-line declarations do not handle escape characters.

The whole suite of special operators available to your shell can 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 (if defined) holds the shell's environment variable that contains the address of the news server as its value.

    Previous Section Next Section