Command aliasing in the Korn shell or POSIX shell
The Korn shell, or POSIX shell, allows you to create aliases to customize commands.
The alias command defines a word of the
form Name=String
as an alias. When you use an alias as the
first word of a command line, the Korn shell checks to see if it is already
processing an alias with the same name. If it is, the Korn shell does not
replace the alias name. If an alias with the same name is not already being
processed, the Korn shell replaces the alias name by the value of the alias.
The first character of an alias name can be any printable character except the metacharacters. The remaining characters must be the same as for a valid identifier. The replacement string can contain any valid shell text, including the metacharacters.
If the last character of the alias value is a blank, the shell also checks the word following the alias for alias substitution. You can use aliases to redefine special built-in commands but not to redefine reserved words. Alias definitions are not inherited across invocations of ksh. However, if you specify alias -x, the alias stays in effect for scripts invoked by name that do not invoke a separate shell. To export an alias definition and to cause child processes to have access to them, you must specify alias -x and the alias definition in your environment file.
Use the alias command to create, list, and export aliases.
Use the unalias command to remove aliases.
alias Name=String
where the Name parameter specifies the name of the alias, and the String parameter specifies the value of the alias.
The following exported aliases are predefined by the Korn shell but can be unset or redefined. It is not recommended that you change them, because this might later confuse anyone who expects the alias to work as predefined by the Korn shell.
autoload='typeset -fu'
false='let 0'
functions='typeset -f'
hash='alias -t'
history='fc -l'
integer='typeset -i'
nohup='nohup '
r='fc -e -'
true=':'
type='whence -v'
Aliases are not supported on noninteractive invocations of the Korn shell (ksh); for example, in a shell script, or with the -c option in ksh, as in the following:
ksh -c alias