Интерактивная система просмотра системных руководств (man-ов)
elmalias (1)
>> elmalias (1) ( Solaris man: Команды и прикладные программы пользовательского уровня )
elmalias (1) ( Linux man: Команды и прикладные программы пользовательского уровня )
NAME
elmalias - expand and display Elm address aliases
SYNOPSIS
elmalias [ -adenrsuvV ] [ -f format ] [ name ... ]
$lib/prlong [ options ... ] < file
DESCRIPTION
Elmalias allows you to examine information about aliases.
The alias databases are consulted for each name on the com-
mand line, and the alias value is displayed, one value per
line of output. If name is not a known alias, then it is
displayed unchanged. If no name is given on the command
line then all alias values in the databases are displayed.
All of these actions are default behaviors that may be modi-
fied by command line options.
There are two possible alias databases, a user-specific
alias file (usually in $HOME/.elm/aliases) and a system-wide
alias file (usually in $lib/aliases). By default both files
are searched, first the user-specific file and then the
system-wide file. If an alias file does not exist then
elmalias silently ignores it and continues on. The -s and
-u command line options (discussed shortly) can restrict
what files are files searched.
There are two types of aliases, Person aliases and Group
aliases. A Person alias expands to an individual address
and a Group alias contains a list of addresses, some of
which may be aliases. By default, elmalias displays the
defined value of an alias, regardless of type. The -e com-
mand line option (discussed shortly) fully expands out Group
aliases.
The default output produced is just the ``Address'' informa-
tion for each name on the command line. A number of command
line options (discussed shortly) may be used to select dif-
ferent output information or specify a format of your choos-
ing. The following information is maintained in the alias
databases, and may be accessed by the elmalias utility:
o Alias (the alias name)
o Last Name
o Name (the user's full name)
o Comment (not displayed in mail headers)
o Address (the alias value)
o Type (Person, Group, or Unknown)
When the name specified on the command line is not a known
alias, both the ``Alias'' and ``Address'' information will
display as the name, the ``Type'' information will display
as ``Unknown'', and all other items will be blank.
The available command line options are:
-a Selects an alternative output format. The ``Alias''
information is displayed in addition to and preceding
the usual ``Address'' information.
-d Turns debugging on. Has no effect unless elmalias was
compiled with debugging enabled.
-e Tells elmalias to fully expand group aliases. This
option can be used only when names are given on the
command line.
-f The output produced will be in the specified format.
Format specifications will be discussed shortly.
-n Selects an alternative output format. The ``Name''
information, if it exists, is displayed in addition to
and following the usual ``Address'' information. The
``Name'' will be enclosed in parenthesis.
-r If a specified name does not correspond to a known
alias then elmalias will display a message and exit
with a nonzero status.
-s Normally elmalias examines both the user-specific and
system-wide alias files. This option requests that
elmalias use the system-wide alias file, and unless the
-u option is also specified the user-specific alias
file will be ignored.
-u Normally elmalias examines both the user-specific and
system-wide alias files. This option requests that
elmalias use the user-specific alias file, and unless
the -s option is also specified the system-wide alias
file will be ignored.
-v Selects a verbose output format. Both the ``Alias''
and the ``Name'' information will be displayed in addi-
tion to the ``Address'' information. The ``Alias''
information will precede the ``Address'' information,
and the ``Name'' information will be enclosed in
parenthesis and follow it. If there is no ``Name''
information for this alias then that portion of the
output will be ignored.
-V Selects a very verbose, multi-line output format.
Displays all available information on aliases.
The output produced by elmalias is fully customizable with
the -f option. The format string uses a syntax similar to
date(1) (System V version) and printf(3). The following
field descriptors may be used in format specifications:
%a Alias (the alias name)
%l Last Name
%n Name (the user's full name)
%c Comment (not displayed in mail headers)
%v Address (the alias value)
%t Type (Person, Group, or Unknown)
Field widths in a [-][m][.n] format (again, similar to
printf(3)) may also be used. For example, "%-20.20a" means
print the ``Alias'' information left justified in a field
twenty characters long, with the value truncated to twenty
characters.
The following special character sequences are also recog-
nized in format specifications:
\b A backspace.
\f A formfeed.
\n A newline.
\r A return.
\t A tab.
\c Literal character ``c''.
There is a very simplistic conditional evaluation mechanism
that may be used in format specifications. The conditional
text should be surrounded by question marks, and a single
character that specifies the condition immediately follows
the first question mark. The condition characters
correspond to the ``%'' field specifier characters, and the
condition is true if the corresponding alias information is
defined and nonempty. For example, if you want to display
the ``Name'' information surrounded by parenthesis, but omit
it if the information is not available, you may use
``?n(%n)?'' in the format specification.
The command line switches that select an alternative format
correspond to the following format specifiers.
default "%v"
-a "%-20.20a %v"
-n "%v?n (%n)?"
-v "%-20.20a %v?n (%n)?"
-V "Alias:\t\t%a\n\
Address:\t%v\n\
Type:\t\t%t\n\
?n Name:\t\t%n\n?\
?l Last Name:\t%l\n?\
?c Comment:\t%c\n?"
The prlong utility formats long amounts of data, folding
across multiple lines. It is useful to reformat output of
elmalias. Prlong reads data from its standard input, one
line at a time, and tries to place as much information as
possible on each output line. A field seperator, by default
a single space, seperates each input record in the output
lines. Every output line is preceded by a leader field. By
default the leader of the first output line is an empty
string, and the leader for all subsequent output lines is a
single tab. prlong will never split an input record. If an
input record exceeds the maximum output line length, it will
appear unmodified on an output line all by itself.
The following options may be used to modify the prlong
behavior.
-wwidth Constrains output lines to width columns in
length (not counting an appended newline charac-
ter). The default is 78 columns. The width
calculation assumes that tabstops occur every
eight spaces.
-fstring Seperates each input record with the indicated
string when displayed to the output. The
default is a single space.
-1string Specifies the leader string used for the first
line of output. (This option is the digit
``one''.) The default is an empty string.
-lstring Specifies the leader string for all subsequent
lines of output. (This option is a lower-case
``ell''.) The default is a single tab.
EXAMPLES
Consider an aliases.text file that contains:
friends = List of Friends = tom, dick, harry
tom = Tom Smith = sleepy!tom
dick = Dick Jones = dopey!dick
harry = = grumpy!harry
Below are shown some example commands and the output pro-
duced.
$ elmaliasfriends
tom,dick,harry
$ elmaliasmike
mike
$ elmalias -rmike
elmalias: "mike" is not a known alias
$ elmalias -nfriends
tom,dick,harry (List of Friends)
$ elmalias -afriends
friends tom,dick,harry
$ elmalias -Vfriends
Alias: friends
Address: tom,dick,harry
Type: Group
Name: List of Friends
Last Name: List of Friends
$ elmalias -efriends[email protected][email protected][email protected]
$ elmalias -vefriends
tom [email protected] (Tom Smith)
dick [email protected] (Dick Jones)
harry [email protected]
$ elmalias -f "alias %ais \"%v\" ?n(%n)?" -efriends
alias tom is "[email protected]" (Tom Smith)
alias dick is "[email protected]" (Dick Jones)
alias harry is "[email protected]"
$ elmalias -enfriends | /usr/lib/elm/prlong -w40[email protected] (Tom Smith)
[email protected] (Dick Jones)
[email protected]
$ elmalias -enfriends | /usr/lib/elm/prlong -1 "To: " -f ", " -w40
To: [email protected] (Tom Smith),
[email protected] (Dick Jones),
[email protected]
The checkalias(1L) and listalias(1L) scripts distributed
with the Elm package provide further examples of the
elmalias and prlong utilities.
There is no centralized, comprehensive interface to the Elm
2.4 alias system, so every program in the Elm suite that
uses aliases implements its own interfaces. It's possible
for inconsistencies to creep in between what elmalias says
and what some Elm utility does. If you find an incon-
sistency please report it to us!
Boy, there sure are a lot of command line switches in this
thing.
Note that the precedence of aliases is user file then system
file. This means that a user can 'overload' an alias by
having one defined in the system file also defined in
theirs. This shouldn't turn out to be a problem, but is
something for the system administrator to keep in mind when
creating the system alias file.