aliasdisplay or create command aliases |
KornShell Built-in |
alias
[-tx
] [name[=value]
...]
alias
-r
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
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 during assignment. As a result, the shell only escapes characters within apostrophes when expanding the alias. Callingname=value
alias
with name without any
value assignment, displays name and its
associated value with appropriate quoting.
-r
removes all tracked aliases.
-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 reassigns a path name the first time you use
the alias after changing the variable PATH
.
When you issue the command
each subsequent command you use in the shell automatically becomes a tracked alias. Invokingset -h
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 (that is,
script.ksh
).
On systems supporting job control:alias functions="typeset -f" alias hash="alias -t" alias history="fc -l" alias integer="typeset -i" alias nohup="nohup " alias r="fc -s"
You can change or remove any of these aliases. See the relevant manual pages for details.alias stop="kill -STOP" alias suspend="stop \$\$"
definesalias ls="ls -C"
ls
as an alias. From this point
onward, when you issue an ls
command,
it produces multi-column output by default.
The alias
command provides a simple way to access other
functions built into the shell.
alias ver="command.com /c ver" alias rename="command.com /c rename" alias copy="command.com /c copy"
0
Successful completion.
1
Failure because an alias could not be set.
2
Failure because of an invalid command line option.
alias
to determine the values of a set of
names, the exit status is the number of those names that are
not currently defined as aliases.
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.
ENV
file, which is executed whenever a new shell is
run.