alias(1) MPE/iX Shell and Utilities alias(1)
______________________________________________________________________
NAME
alias -- display or create command aliases
SYNOPSIS
alias -tx [name[=value] ...]
DESCRIPTION
When the first word of a shell command line is not a shell key-
word, the shell checks for the word in the list of currently
defined aliases. If it finds a match, the shell replaces the
alias with its associated string value. The result is a new com-
mand line that might begin with a shell function name, a built-in
command, an external command or another alias.
When the shell performs alias substitution, it checks to see if
value ends with a blank. If so, the shell also checks the next
word of the command line for aliases. The shell then checks the
new command line for aliases and expands them, following these
same rules. or recursion occurs in the expansion of aliases.
Calling alias without parameters displays all the currently
defined aliases and their associated values. Values appear with
appropriate quoting so that they are suitable for re-input to the
shell.
Calling alias with parameters in the form of
name=value
creates an alias for each name with the given string value.
If you are defining an alias where value contains a backslash
character, you must precede it with another backslash since when
the shell performs the expansion, it interprets a backslash as
the escape character. If you use double quotes to enclose value,
you must precede each component of a double backslash with an
additional backslash since the shell escapes characters both when
assigning the alias and again when expanding it
To avoid using four backslashes to represent a single backslash,
use apostrophes rather than double quotes to enclose value, since
the shell does not escape characters enclosed in apostrophes dur-
ing assignment. As a result, the shell only escapes characters
within apostrophes when expanding the alias.
Calling alias with name without any value assignment, displays
name and its associated value with appropriate quoting.
1
alias(1) MPE/iX Shell and Utilities alias(1)
______________________________________________________________________
Options
alias accepts the following options:
-t makes each name on the command line a tracked alias. Each
tracked alias resolves to its full path name; thus the shell
avoids searching the PATH directories whenever you invoke
the command. The shell assigns the full path name of a
tracked alias the first time that you invoke it. It reas-
signs a path name the first time you use the alias after
changing the variable PATH or running the shell command cd.
When you issue the command
set -h
each subsequent command you use in the shell automatically
becomes a tracked alias. Invoking alias with the -t option,
but without any specified names, displays all currently
defined tracked aliases with appropriate quoting.
-x marks each alias name on the command line for export. If
you specify -x without any names, alias displays all
exported aliases. Only exported aliases are passed to a
shell that runs a shell script.
Built-in Aliases
There are several aliases built into the shell:
alias functions="typeset -f"
alias hash="alias -t"
alias history="fc -l"
alias integer="typeset -i"
alias r="fc -s"
On systems supporting job control:
alias stop="kill -STOP"
alias suspend="stop \$\$"
You can change or remove any of these aliases. See the relevant
manual pages for details.
EXAMPLES
The command:
alias ls="ls -C"
defines ls as an alias. From this point onward, when you issue
an ls command, it produces multi-column output by default.
2
alias(1) MPE/iX Shell and Utilities alias(1)
______________________________________________________________________
DIAGNOSTICS
Possible exit status values are:
0 Successful completion.
1 Failure because an alias could not be set.
2 Failure because of an invalid command line option.
If you define alias to determine the values of a set of names,
the exit status is the number of those names which are not cur-
rently defined as aliases.
Messages
Because this utility is built into the MPE/iX Shell, see the
sh(1) man page for a complete list of error messages that you may
receive when using it.
PORTABILITY
KornShell. POSIX.2. x/OPEN Portability Guide 4.0.
On UNIX systems, alias is a built-in command of the KornShell,
but not of the Bourne Shell.
The -t and -x options are extensions to the POSIX standard.
NOTE
This command is built into the shell.
Since exported aliases are only available in the current shell
environment and to the child processes of this environment, they
will be unavailable to any new shell environment which are
started. To make an alias available to all shell environments,
define it as a non-exported alias in the MPE/iX Shell ENV file,
which is executed whenever a new shell is run.
SEE ALSO
cd(1), fc(1), functions(1), hash(1), history(1), integer(1),
let(1), pwd(1), r(1), set(1), sh(1), typeset(1), unalias(1)
3