ALIAS(1CSH) COMMAND REFERENCE ALIAS(1CSH)
NAME
alias, unalias - alias substitutions (csh built-in)
SYNOPSIS
alias [ name [ wordlist ] ]
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
wordlist for that name is printed. With a name and a
wordlist, the wordlist 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.
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
occurs in a command position.
alias list ls -lR
Printed 10/17/86 1
ALIAS(1CSH) COMMAND REFERENCE ALIAS(1CSH)
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 it's 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 can not 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), which(1csh).
Printed 10/17/86 2
%%index%%
na:72,105;
sy:177,222;
de:399,2628;
ex:3027,249;3420,117;
ca:3537,779;
se:4316,1478;
%%index%%000000000118