ALIAS(1CSH) COMMAND REFERENCE ALIAS(1CSH)
NAME
alias, unalias - alias substitutions (csh built-in)
SYNOPSIS
alias [ name [ command(s) aliased ] ]
unalias pattern
DESCRIPTION
The shell maintains a list of aliases which can be
established, displayed, and modified by the alias and
unalias commands. With no arguments, alias prints the names
and wordlists for all aliases set. With a name, the
commands aliased for that name are printed. With a name and
a list of aliased commands, the list of aliased commands is
subjected to command and filename substitution and assigned
to the name as an alias. The unalias command deletes any
aliases that match the given pattern. The command unalias *
deletes all aliases.
After a command line is scanned, it is parsed into distinct
commands and the first word of each command, left-to-right,
is checked to see if it has an alias. If it does, then the
text which is the alias for that command is reread with the
history mechanism available as though that command were the
previous input line. The resulting words replace the
command and argument list. If no reference is made to the
history list, then the argument list is left unchanged.
Thus if the alias for ls is ls -l the command ls usr would
map to ls -l usr, the argument list here being undisturbed.
Similarly if the alias for lookup was grep !^ /etc/passwd
then lookup bill would map to grep bill /etc/passwd.
If an alias is found, the word transformation of the input
text is performed and the aliasing process begins again on
the reformed input line. Looping is prevented, if the first
word of the new text is the same as the old, by flagging it
to prevent further aliasing. Other loops are detected and
cause an error.
Aliases can be set by any user. A .alias file containing a
list of aliases can be created in an individual user's
account. Aliases may also be included in the .cshrc file for
C-shell users.
Note that the mechanism allows aliases to introduce parser
metasyntax. Thus you can alias print 'pr \!* | lpr' to make
a command which pr's its arguments to the line printer.
EXAMPLES
The following command causes the command ``ls -lR'' to be
substituted for occurrences of the word ``list'' when it
Printed 4/6/89 1
ALIAS(1CSH) COMMAND REFERENCE ALIAS(1CSH)
occurs in a command position.
alias list ls -lR
This command will delete any two-character aliases that end
with the letter `e'.
unalias ?e
CAVEATS
Aliases can not contain the names ``alias'' or ``unalias''.
If an alias contains its own name in backquotes, an infinite
loop may occur, which will crash the shell. An example of
one of these is:
alias ls 'echo `ls`'
Aliases cannot always be used in place of simple commands,
such as in simple if statements.
When one command of a multi-command alias is suspended, the
other commands are forgotten by the shell. If all commands
of a multi-command alias need to be executed without being
affected by suspension, the alias should be surrounded by
parentheses, as in the following:
alias change '(co -l \!* ; vi \!* ; ci -u \!* )'
SEE ALSO
@(1csh), bg(1csh), break(1csh), cd(1csh), chdir(1csh),
continue(1csh), csh(1csh), dirs(1csh), echo(1csh),
eval(1csh), exec(1csh), exit(1csh), fg(1csh), glob(1csh),
goto(1csh), hashstat(1csh), history(1csh), jobs(1csh),
kill(1csh), limit(1csh), logout(1csh), nice(1csh),
nohup(1csh), notify(1csh), onintr(1csh), popd(1csh),
pushd(1csh), rehash(1csh), repeat(1csh), set(1csh),
setenv(1csh), sh(1sh), shift(1csh), source(1csh),
stop(1csh), suspend(1csh), time(1csh), umask(1csh),
unhash(1csh), unalias(1csh), unlimit(1csh), unset(1csh),
unsetenv(1csh), wait(1csh), and which(1csh).
Printed 4/6/89 2
%%index%%
na:336,133;
sy:469,326;
de:795,3391;
ex:4186,214;4808,179;
ca:4987,809;
se:5796,1514;
%%index%%000000000119