In the Korn shell, an alias is a command word that the Korn shell uses to replace a string. For example, the Korn shell includes the command r, which is actually the command fc -s. When you type r at the prompt, the Korn shell substitutes the r with the command fc -s.
Aliases are ideal for applications such as word processors, where the directory containing the application might have only one executable file. Adding this kind of directory to the PATH can create unnecessary clutter. Although you can start the application at the prompt by typing the entire path and application name, this can introduce typing errors. To create an alias called word that runs Microsoft Word, for example, you could type the following at the Korn shell dollar-sign ($) prompt:
alias word="'/dev/fs/C/Program Files/Microsoft Office/Office/WINWORD.EXE'"
In the Korn shell, the value of the alias must be surrounded by double quotation marks ("). The above example also includes single quotation marks (') because the path to the application contains spaces. The following example contains no single quotations marks because the path has no spaces:
alias pe="/dev/fs/C/WINNT/poledit.exe"
In the C shell, enclose the path and application name with single quotation marks ('). For example, to create an alias for Microsoft Word, at the C shell prompt (%), you could type the following:
alias word '/dev/fs/C/"Program Files"/"Microsoft Office"/Office/WINWORD.EXE'
A user does not need administrator privileges to set up aliases.
The file /usr/examples/win32/aliases.ksh contains Korn shell aliases for Win32 commands. You can include these aliases in your environment by adding the following line to your .profile file:
. /usr/examples/win32/aliases.ksh
The file /usr/examples/win32/aliases.csh contains Win32 aliases for the C shell. You can add the following line to your .cshrc file:
source /usr/examples/win32/aliases.csh
Some Win32 commands use the same names as Interix utilities. These commands have alias names that start with a w. For example, print.exe is aliased as wprint. The following commands are aliased with an initial w.
Command | Interix alias | Function of the Win32 command | Function of the Interix utility |
---|---|---|---|
expand | wexpand | Expands compressed files. | Expands tab characters in text files. |
find | wfind | Operates in a way that is similar to the Interix grep utility. | Finds files in the file system. |
ftp | wftp | File transfer protocol (FTP) client. | File transfer protocol (FTP) client. |
pax | wpax | POSIX portable archive tool. | POSIX portable archive tool. |
sort | wsort | Performs sorting. | Performs sorting. |
telnet | wtelnet | Telnet client. | Telnet client. |
The following aliases are found in the Korn shell:
Command | Interix alias | Function of the Win32 command | Function of the Interix utility |
---|---|---|---|
fc | wfc | Operates in a way that is similar to the Interix diff utility. | Displays the command history. |
wprint | Sends a file to the printer. | Writes its arguments to the standard output. |