Defines an alias (alternative) name for a command or macro.
Syntax |
 |
Aliases are useful for defining a new (shorter or longer)
name for a command name or macro name. Aliases have higher precedence
than command or macro names, and they can therefore be used to redefine
(or conceal) commands or macros. When a new alias redefines a command,
a warning is generated, indicating that a command has been hidden.
User defined aliases, created with the ALIAS command, are classified as user aliases. Several predefined aliases (command abbreviations)
are automatically generated, and are classified as predefined aliases. Refer to the ALIASLIST and ALIASINIT commands.
Examples |
 |
$nmdebug > printtableentrylength 6 $200 $nmdebug > alias tbl printtableentrylength $nmdebug > tbl 6 $200 |
The above example assumes that a macro called printtableentrylength has been defined, and a typical macro invocation
is displayed. Since the macro name is long, and difficult to enter,
an alias named TBL is defined. The shorter alias name can now be
used in place of the longer macro name.
$nmdebug > alias loop foreach $nmdebug > loop j '1 2 3' {wl j} $1 $2 $3 |
Create an alias named LOOP that is the same as the FOREACH command.
$nmdat > macro concealexit { wl "type EXIT to exit."} $nmdat > alias e concealexit A command is hidden by this new alias. (warning #71) $nmdat > e type EXIT to exit. |
In this example, the single character command e (for EXIT) is protected by an alias, that conceals (hides)
the original command. Note that a warning message is generated whenever
a command name is concealed by an alias definition.
$nmdat > alias one two $nmdat > alias two three $nmdat > alias three one $nmdat > one Circular ALIAS error. Recursive ALIAS definition(s). (error #2445) |
It is legal for an alias (for example, one in the example above) to refer to another alias
(two in the example above), so long as the chain of
aliases does not wrap back onto itself. Recursive aliases are detected,
and an error is generated.
$nmdat > alias showtime "wl time" $nmdat > aliasl showtime alias showtime wl time /* user $nmdat > showtime Unknown command. (error #6105) Command "showtime" was aliased to "wl time". |
Note that alias command names are restricted to simple command
or macro names. In the above example, the command wl time was assumed to be the name of a command or macro.
Since no match was found in the command or macro table, an error
is generated. Macros should be used when more complex command lists
or commands with parameters are desired.
Related commands: ALIASINIT, ALIASL, ALIASD.