Each line of an nmh alias file takes one of the following forms:
- alias : address-group
- alias ; address-group
- < alias-file
- ; | : | # comment
address-group := address-list | < file | = UNIX-group | + UNIX-group | * address-list := address | address-list, address
Continuation lines end with ``\'' followed by a newline
character. This also applies to comment lines. Thus, the line following a ``\''-terminated comment line is a continuation of that comment line.
Alias-file and file are UNIX file names. UNIX-group is a group name or number from the system's group database. Alias file contents are case-insensitive, with the exception of filesystem path names.
If the line starts with a ``<'', the file named after the ``<'' is read for more alias definitions. The reading is done recursively, so a ``<'' may occur in the beginning of an alias file with the expected results.
If the address-group starts with a ``<'', the file named after the ``<'' is read and its contents are added to the address-list for the alias.
If the address-group starts with an ``='', the system's group database is consulted for the UNIX-group named after the ``=''. Each login name occurring as a member of the group is added to the address-list for the alias.
In contrast, if the address-group starts with a ``+'', the system's group database is consulted to determine the group-id of the UNIX-group named after the ``+''. Each login name occurring in the system's password database whose group-id is indicated by this group is added to the address-list for the alias.
If the address-group is simply ``*'', the system's password database is consulted and all login names with a userid greater than some magic number (usually 200) are added to the address-list for the alias. This feature is obsolescent and will be removed in a future release.
In match, a trailing ``*'' on an alias will match just about anything appropriate.
An approximation of the way aliases are resolved at posting time is:
- Build a list of all addresses from the message to be delivered, eliminating duplicate addresses.
- If this draft originated on the local host, then for those addresses in the message that have no host specified, perform alias resolution.
- For each line in the alias file, compare ``alias'' against all of the existing addresses. If a match, remove the matched ``alias'' from the address list, and add each new address in the address-group to the address list if it is not already on the list. The alias itself is not usually output, rather the address-group that the alias maps to is output instead. If ``alias'' is terminated with a ``;'' instead of a ``:'', then both the ``alias'' and the address are output in the correct format (with the alias quoted if necessary and the address wrapped in <>).
Since the mh-alias file is read line by line, forward references work, but backward references are not recognized.
Example Alias File
</etc/nmh/BBoardAliases fred: [email protected] sgroup: fred, fear, freida b-people: Blind List: bill, betty UNIX-committee: <unix.aliases staff: =staff wheels: +wheel news.*: news
The first line says that more aliases should immediately be read from the file /etc/nmh/BBoardAliases. Following this, ``fred'' is defined as an alias for ``[email protected]'', and ``sgroup'' is defined as an alias for the three names ``[email protected]'', ''fear'', and ''freida''.
The alias ``b-people'' is a blind list which includes the addresses ``bill'' and ``betty''; the message will be delivered to those addresses, but the message header will show only ``Blind List: ;'' (not the addresses). The alias must not be terminated with, or contain, a semicolon. Note that blind lists are not supported with the sendmail/pipe mail transport method.
Next, the definition of ``UNIX-committee'' is given by reading the file unix.aliases in the user's nmh directory, ``staff'' is defined as all users who are listed as members of the group ``staff'' in the system's group database, and ``wheels'' is defined as all users whose group-id in the system's password database is equivalent to the ``wheel'' group.
- Default alias file.
- System-wide default alias file.
BUGSAlthough the forward-referencing semantics of mh-alias files prevent recursion, the alias-file directive may defeat this. Since the number of file descriptors is finite, such infinite recursion will terminate with a meaningless diagnostic when all the fds are used up.
Earlier versions of this man page showed a semicolon at the end of the blind list example. That caused the preceding alias to not be expanded. There must not be a semicolon at the end of, or within, the address group of a blind list. post will append the semicolon to the blind list name.