alias(1)


alias, unalias -- define, display, and remove shell aliases

Synopsis

/u95/u95/bin/alias [/u95/bin/alias-name[=string] ...]

/usr/bin/unalias alias-name ...

/usr/bin/unalias -a

Description

This shell script executes the builtin command of the same name as implemented by the /u95/bin/sh shell. See ksh(1) for more information on this shell.

The alias command creates or redefines alias definitions or writes the values of existing alias definitions to standard output. An alias definition provides a string value that replaces a command name when it is encountered. The unalias command removes alias definitions from the current shell environment.

An alias definition affects the current shell execution environment and the execution environments of the subshells of the current shell. The alias definition will not affect the parent process of the current shell nor any utility environment invoked by the shell.

See the ksh(1) manual page for a description of alias processing and the shell execution environment.

Flags

The -a option to the unalias command removes all alias definitions from the current shell.

Operands

If no operands are given to the alias command, all alias definitions in the current execution environment are written to the standard output.

The following operands are supported:


alias-name
Specifies an existing alias name in the current shell's execution environment.

When one or more alias-names are used with the alias command, the given alias definitions are written to standard output. Using one or more alias-names with the unalias command removes the given aliases from the current shell's execution environment.


alias-name=string
This operand to the alias command creates a new alias definition in the current shell's execution environment by assigning the value of string to the alias alias-name.

Environment variables

The following environment variables affect the execution of alias and unalias:

LANG
Provide a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL
If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).

LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

Output

The alias command writes alias definitions one per line to standard output in the format:
   name=value
The value string is written with appropriate quoting so that it is suitable for reinput to the shell. See the description of shell quoting in sh(1).

Standard error is used only for diagnostic messages.

Exit codes

An exit value of 0 indicates successful completion. A value greater than 0 indicates that one of the alias-name operands specified did not have an alias definition, or that some other error occurred.

Usage

Change ls to give a columnated, more annotated output:
   alias ls="ls -CF"
Create a simple ``redo'' command to repeat previous entries in the command history file:
   alias r='fc -s'
Use 1K units for du(1M):
   alias du=du -k
Set up nohup(1) so that it can deal with an argument that is itself an alias name:
   alias nohup="nohup "

References

ksh(1)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005