\input texinfo.tex @c -*- texinfo -*-
@c %**start of header
@setfilename zsh.info
@settitle    zsh
@c %**end of header

@setchapternewpage odd
@iftex
@finalout
@end iftex

@ifinfo
This is a texinfo version of the man page for the Z Shell, originally by Paul
Falstad.  It was converted from the @code{zsh.1} file
distributed with zsh v2.5.0.  The conversion was done by Jonathan
Hardwick, @code{jch@@cs.cmu.edu}, who would love to hear of any errors
he introduced or texinfo rules he broke.  The text remains the work of
Paul Falstad.@refill
@end ifinfo

@titlepage
@sp 4
@center @titlefont{The Z Shell}
@sp 2
@center Originally by Paul Falstad
@center pf@@z-code.com
@sp 2
@center 30 December 1993
@page
@vskip 0pt plus 1filll
This is a texinfo version of the man page for the Z Shell, by Paul
Falstad.  It was converted from the original @code{zsh.1} file
distributed with zsh v2.5.0.  The conversion was done by Jonathan
Hardwick, @code{jch@@cs.cmu.edu}, who would love to hear of any errors
he introduced or texinfo rules he broke.  The text remains the work of
Paul Falstad.
@end titlepage

@node Top, Shell Grammar, (dir), (dir)
@c @top zsh

@menu
* Shell Grammar::		
* Expansion::			
* Redirection::			
* Command Execution::		
* Functions::			
* Jobs & Signals::		
* History::			
* Arithmetic Evaluation::	
* Conditional Expressions::	
* Zsh Line Editor::		
* Parameters::			
* Options::			
* Shell Builtin Commands::	
* Invocation::			
* Wrapping Up::			

 --- Indices ---

* Concept Index::		
* Variables Index::             
* Options Index::               
* Functions Index::             
* Editor Functions Index::      
* Keystroke Index::             

 --- The Detailed Node Listing ---

Shell Grammar

* Simple Commands & Pipelines:: 
* Complex Commands::            
* Reserved Words::              
* Comments::                    
* Aliasing::                    
* Quoting::                     

Expansion

* Filename Expansion::          
* Process Substitution::        
* Parameter Expansion::         
* Command Substitution::        
* Arithmetic Expansion::        
* Brace Expansion::             
* Filename Generation::         

History

* Event Designators::           
* Word Designators::            
* Modifiers::                   

Zsh Line Editor

* Movement::                    
* History Control::             
* Modifying Text::              
* Arguments::                   
* Completion::                  
* Miscellaneous::               

Parameters

* Array Parameters::            
* Positional Parameters::       
* Parameters Set By The Shell::  
* Parameters Used By The Shell::  

Wrapping Up
@end menu

@node Shell Grammar, Expansion, Top, Top
@chapter Shell Grammar
@cindex shell grammar
@cindex grammar, shell

@menu
* Simple Commands & Pipelines::	 
* Complex Commands::		
* Reserved Words::		
* Comments::			
* Aliasing::			
* Quoting::			
@end menu

@node Simple Commands & Pipelines, Complex Commands,  , Shell Grammar
@section Simple Commands
@cindex simple commands
@cindex commands, simple

@noindent
A @dfn{simple command} is a sequence of optional parameter assignments
followed by blank-separated words, with optional redirections
interspersed.  The first word is the command to be executed, and the
remaining words, if any, are arguments to the command.  If a command
name is given, the parameter assignments modify the environment of the
command when it is executed.  The value of a simple command is its exit
status, or 128 plus the signal number if terminated by a signal.@refill

@noindent
If a simple command is preceded by the word @code{exec}, it is executed
@findex exec
in the parent shell without forking.  If preceded by @code{command}, the
@findex command
command word is taken to be the name of an external command, rather than
a shell function or builtin.  If preceded by @code{noglob}, filename
@findex noglob
generation is not performed on any of the words.  If preceded by a
@code{-}, the command is executed with a @code{-} prepended to its
@code{argv[0]} string.  If preceded by @code{nocorrect}, spelling
@findex nocorrect
correction is not done on any of the words.@refill

@noindent
A @dfn{pipeline} is a sequence of one or more commands separated by
@cindex pipeline
@code{|} or @code{|&}.  @code{|&} is shorthand for @code{2>&1 |}.  The
standard output of each command is connected to the standard input of
the next command in the pipeline.@refill

@noindent
The value of a pipeline is the value of the last command.  If a pipeline
@cindex pipeline, value of
is preceded by a @code{!}, the value of that pipeline is the logical NOT
of the value of the last command.@refill

@noindent
If a pipeline is preceded by @code{coproc}, it is executed as a
@findex coproc
coprocess; a two-way pipe is established between it and the parent
@cindex coprocesses
shell.  The shell can read from or write to the coprocess by means of
the @code{>&p} and @code{<&p} redirection operators.@refill

@noindent
A @dfn{sublist} is a sequence of one or more pipelines separated by
@cindex sublist
@code{&&} or @code{||}.  If two pipelines are separated by @code{&&},
the second pipeline is executed only if the first is successful (returns
a zero value).  If two pipelines are separated by @code{||}, the second
is executed only if the first is unsuccessful (returns a nonzero
value).  Both operators have equal precedence and are left 
associative.@refill

@noindent
A @dfn{list} is a sequence of one or more sublists separated by, and
@cindex list
optionally terminated by, @code{;}, @code{&}, or a newline.  Normally
the shell waits for each list to finish before executing the next one.
If a list is terminated by a @code{&}, the shell executes it in the
background, and does not wait for it to finish.@refill

@node Complex Commands, Reserved Words, Simple Commands & Pipelines, Shell Grammar
@section Complex Commands
@cindex complex commands
@cindex commands, complex

@noindent
A @dfn{complex command} is one of the following:

@table @code
@item for @var{name} [ in @var{word} @dots{} ]
@cindex for loops
@cindex loops, for
@findex for
@itemx do @var{list}
@itemx done
Expand the list of @var{word}s, and set the parameter @var{name} to each
of them in turn, executing @var{list} each time.  If the @code{in
@var{word}} is omitted, use the positional parameters instead of the
@var{word}s.@refill

@item for @var{name} [ in @var{word} @dots{} ] ; @var{sublist}
This is a shorthand for @code{for}.  Though it may cause confusion, it
is included for convenience; its use in scripts is discouraged, unless
@var{sublist} is a command of the form @{ @var{list} @}.@refill

@item foreach @var{name} ( @var{word} @dots{} )
@findex foreach
@itemx @var{list}
@itemx end
Another form of @code{for}.

@item for @var{name} in @var{word} @dots{}
@itemx @{
@itemx @var{list}
@itemx @}
Another form of @code{for}.

@item for @var{name} ( @var{word} @dots{} ) @{
@itemx @var{list}
@itemx @}
Another form of @code{for}; this requires the option
@code{CSH_JUNKIE_PAREN}.@refill

@item for @var{name} ( @var{word} @dots{} ) @var{sublist}
Another form of @code{for}; this also requires
@code{CSH_JUNKIE_PAREN}.@refill

@item select @var{name} [ in @var{word} @dots{} ]
@cindex selection, user
@cindex user selection
@findex select
@itemx do @var{list}
@itemx done
Print the set of @var{word}s, each preceded by a number.  If the
@code{in @var{word}} is omitted, use the positional parameters.  The
@code{PROMPT3} prompt is printed and a line is read from standard input.
If this line consists of the number of one of the listed @var{word}s,
then the parameter @var{name} is set to the @var{word} corresponding to
this number.  If this line is empty, the selection list is printed
again.  Otherwise, the value of the parameter @var{name} is set to null.
The contents of the line read from standard input is saved in the
parameter @code{REPLY}.  @var{list} is executed for each selection until
a break or end-of-file is encountered.@refill

@item select @var{name} [ in @var{word} ] ; @var{sublist}
A short form of @code{select}.

@item case @var{word} in [ @var{pattern} ) @var{list} ;; ] @dots{} esac
@findex case
@cindex case selection
@cindex selection, case
Execute the @var{list} associated with the first @var{pattern} that
matches @var{word}, if any.  The form of the patterns is the same as
that used for filename generation.  @xref{Filename Generation}.@refill

@item case @var{word} @{ [ @var{pattern} ) @var{list} ;; ] @dots{} @}
Another form of @code{case}.

@item if @var{list}
@findex if
@cindex if construct
@itemx then @var{list}
@itemx [ elif @var{list} ; then @var{list} ] @dots{}
@itemx [ else @var{list} ]
@itemx fi
The @code{if @var{list}} is executed, and, if it returns a zero exit
status, the @code{then @var{list}} is executed.  Otherwise, the
@code{elif @var{list}} is executed and, if its value is zero, the
@code{then @var{list}} is executed.  If each @code{elif @var{list}}
returns nonzero, the @code{else @var{list}} is executed.@refill

@item if ( @var{list} ) @var{sublist}
A short form of @code{if}; this requires the option
@code{CSH_JUNKIE_PAREN}.@refill

@item if ( @var{list} ) @{
@itemx @var{list}
@itemx @} elif ( @var{list} ) @{
@itemx @var{list}
@itemx @} @dots{} else @{
@itemx @var{list}
@itemx @}
An alternate form of @code{if}.  The parentheses surrounding @var{list}
can be omitted if the only command in the list is a conditional
expression of the form @code{[[ @var{exp} ]]}.  @xref{Conditional
Expressions}.  This form also requires @code{CSH_JUNKIE_PAREN}.@refill

@item while @var{list}
@findex while
@cindex while loops
@cindex loops, while
@itemx do @var{list}
@itemx done
Execute the @code{do @var{list}} as long as the @code{while @var{list}}
returns a zero exit status.@refill

@item while ( @var{list} ) @{
@itemx @var{list}
@itemx @}
An alternate form of @code{while}; this requires the option
@code{CSH_JUNKIE_PAREN}.@refill

@item until @var{list}
@findex until
@cindex until loops
@cindex loops, until
@itemx do @var{list}
@itemx done
Execute the @code{do @var{list}} as long as the @code{until @var{list}}
returns a nonzero exit status.@refill

@item repeat @var{word}
@findex repeat
@cindex repeat loops
@cindex loops, repeat
@itemx do @var{list}
@itemx done
@var{word} is expanded and treated as an arithmetic expression, which
must evaluate to a number @var{n}.  @var{list} is then executed @var{n}
times.@refill

@item repeat @var{word} @var{sublist}
This is a short form of @code{repeat}.

@item ( @var{list} )
@cindex subshells
Execute @var{list} in a subshell.

@item @{ @var{list} @}
Execute @var{list}.

@item function @var{word} [ () ] @dots{} @{ @var{list} @}
@itemx @var{word} @dots{} () @{ @var{list} @}
@itemx @var{word} @dots{} () @var{sublist}
Define a function which is referenced by any one of @var{word}.
Normally, only one @var{word} is provided; multiple @var{word}s are
usually only useful for setting traps.  The body of the function is the
@var{list} between the @code{@{} and @code{@}}.
@xref{Functions}.@refill

@item time [ @var{pipeline} ]
@cindex timing
The @var{pipeline} is executed, and timing statistics are reported on
the standard error in the form specified by the @code{TIMEFMT}
parameter.  If @var{pipeline} is omitted, print statistics about the
shell process and its children.@refill

@item [[ @var{exp} ]]
@cindex testing conditional expression
Evaluates the conditional expression @var{exp} and return a zero exit
status if it is true.  @xref{Conditional Expressions}, for a description
of @var{exp}.@refill
@end table

@node Reserved Words, Comments, Complex Commands, Shell Grammar
@section Reserved Words
@cindex reserved words

@noindent
The following words are recognized as @dfn{reserved words} when used as
the first word of a command unless quoted or removed using the
@code{unalias} builtin:@refill
@findex unalias, use of

@noindent
@code{do} @code{done} @code{esac} @code{then} @code{elif} @code{else}
@code{fi} @code{for} @code{case} @code{if} @code{while} @code{function}
@code{repeat} @code{time} @code{until} @code{exec} @code{command}
@code{select} @code{coproc} @code{noglob} @code{-} @code{nocorrect}
@code{foreach} @code{end} @refill

@node Comments, Aliasing, Reserved Words, Shell Grammar
@section Comments
@cindex comments

@noindent
In noninteractive shells, or in interactive shells with the
@code{INTERACTIVE_COMMENTS} option set, a word beginning with the third
@pindex INTERACTIVE_COMMENTS, use of
character of the @code{HISTCHARS} parameter (@code{#} by default) causes
@vindex HISTCHARS, use of
that word and all the following characters up to a newline to be
ignored.@refill

@node Aliasing, Quoting, Comments, Shell Grammar
@section Aliasing
@cindex aliasing

@noindent
Every token in the shell input is checked to see if there is an alias
defined for it.  If so, it is replaced by the text of the alias if it is
in command position (if it could be the first word of a simple command),
or if the alias is global.  If the text ends with a space, the next word
in the shell input is treated as though it were in command position for
purposes of alias expansion.  An alias is defined using the @code{alias}
@findex alias, use of
@cindex aliases, global
builtin; global aliases may be defined using the @code{-g} option to
that builtin.@refill

@noindent
Alias substitution is done on the shell input before any other
substitution except history substitution.  Therefore, if an alias is
defined for the word @samp{foo}, alias substitution may be avoided by
quoting part of the word, e.g.@: @samp{\foo}.  But there is nothing to
prevent an alias being defined for @samp{\foo} as well.@refill

@node Quoting,  , Aliasing, Shell Grammar
@section Quoting
@cindex quoting

@noindent
A character may be @dfn{quoted} (that is, made to stand for itself) by
preceding it with a @code{\}.  @code{\} followed by a newline is
ignored.  All characters enclosed between a pair of single quotes
@ifinfo
(@code{@'@'}) are quoted, except the first character of @code{HISTCHARS}
@end ifinfo
@iftex
(@code{''}) are quoted, except the first character of @code{HISTCHARS}
@end iftex
(@code{!} by default).  A single quote cannot appear within single
quotes.  Inside double quotes (@code{""}), parameter and command
substitution occurs, and @code{\} quotes the characters @code{\},
@code{`}, @code{"}, and @code{$}. @refill

@node Expansion, Redirection, Shell Grammar, Top
@chapter Expansion
@cindex expansion

@noindent
Expansion is performed on the command line after it has been parsed.
The types of expansions performed are @dfn{filename expansion},
@dfn{process substitution}, @dfn{parameter expansion}, @dfn{command
substitution}, @dfn{arithmetic expansion}, @dfn{brace expansion}, and
@dfn{filename generation}.@refill

@menu
* Filename Expansion::		
* Process Substitution::	
* Parameter Expansion::		
* Command Substitution::	
* Arithmetic Expansion::	
* Brace Expansion::		
* Filename Generation::		
@end menu

@node Filename Expansion, Process Substitution,  , Expansion
@section Filename Expansion
@cindex filename expansion
@cindex expansion, filename

@noindent
Each word is checked to see if it begins with an unquoted @code{~}.  If
it does, then the word up to a @code{/} is checked to see if it matches
the name of a named directory.  If so, then the @code{~} and the matched
portion are replaced with the value of the named directory.  A @code{~}
by itself or followed by a @code{/} is replaced by the value of the
@code{HOME} parameter.  A @code{~} followed by a @code{+} or a @code{-}
is replaced by the value of @code{PWD} or @code{OLDPWD},
respectively.@refill

@noindent
Named directories are typically login directories for users on the
@cindex directories, named
@cindex named directories
system.  They may also be defined if the text after the @code{~} is the
name of a string shell parameter whose value begins with a @code{/}.  In
certain circumstances (in prompts, for instance), when the shell prints
a path, the path is checked to see if it has a named directory as its
prefix.  If so, then the prefix portion is replaced with a @code{~}
followed by the name of the directory.  The longest match is
preferred.@refill

@noindent
If a word begins with an unquoted @code{=} and the @code{NO_EQUALS}
option is not set, the remainder of the word is taken as the name of a
command or alias.  If a command exists by that name, the word is
replaced by the full pathname of the command.  If an alias exists by
that name, the word is replaced with the text of the alias.  Otherwise
the word is checked up to a @code{/} to see if it is a number or a
@code{-}.  If so, the matched portion is replaced with the @var{n}'th
directory in the directory stack, where @var{n} is the number matched,
or the last directory in the directory stack if a @code{-} is
matched.@refill

@noindent
Filename expansion is performed on the right hand side of a parameter
assignment, including those appearing after commands of the
@code{typeset} family.  In this case, the right hand side will be
treated as a colon-separated list in the manner of @code{PATH}, so that
a @code{~} or @code{=} following a @code{:} is eligible for expansion.
All such behaviour can be disabled by quoting the @code{~}, @code{=}, or
the whole expression (but not simply the colon); the @code{NO_EQUALS}
option is also respected.@refill

@noindent
If the option @code{MAGIC_EQUAL_SUBST} is set, any unquoted shell
argument of the form @code{@var{identifier}=@var{expression}} becomes
eligible for file expansion as described in the previous paragraph.
Quoting the first @code{=} also inhibits this.@refill

@node Process Substitution, Parameter Expansion, Filename Expansion, Expansion
@section Process Substitution
@cindex process substitution
@cindex substitution, process

@noindent
Each command argument of the form @code{<(@var{list})},
@code{>(@var{list})} or @code{=(@var{list})} is subject to process
substitution.  In the case of the @code{<} and @code{>} forms, the shell
will run process @var{list} asynchronously, connected to a named pipe
(FIFO).  The name of this pipe will become the argument to the command.
If the form with @code{>} is selected then writing to this file will
provide input for @var{list}.  If @code{<} is used, then the file passed
as an argument will be a named pipe connected to the output of the
@var{list} process.  For example,@refill

@code{paste <(cut -f1 @var{file1}) <(cut -f3 @var{file2}) | tee >(@var{process1}) >(@var{process2}) >/dev/null}

@noindent
@code{cut}s fields 1 and 3 from the files @var{file1} and @var{file2}
respectively, @code{paste}s the results together, and sends it to the
processes @var{process1} and @var{process2}.  Note that the file, which
is passed as an argument to the command, is a system pipe so programs
that expect to @code{lseek(2)} on the file will not work.  Also note
that the previous example can be more compactly and efficiently written
as:@refill

@code{paste <(cut -f1 @var{file1}) <(cut -f3 @var{file2}) >>(@var{process1}) >>(@var{process2})}

@noindent
The shell uses pipes instead of FIFOs to implement the latter two
process substitutions in the above example.

@noindent
If @code{=} is used, then the file passed as an argument will be the name
of a temporary file containing the output of the @var{list} process.
@cindex temporary files
@cindex files, temporary
This may be used instead of the @code{<} form for a program that expects
to @code{lseek(2)} on the input file.@refill

@node Parameter Expansion, Command Substitution, Process Substitution, Expansion
@section Parameter Expansion
@cindex parameter expansion
@cindex expansion, parameter

@noindent
The character @code{$} is used to introduce parameter expansions.
@xref{Parameters}, for a description of parameters.@refill

@table @code
@item $@{@var{name}@}
The value, if any, of the parameter @var{name} is substituted.  The
braces are required if @var{name} is followed by a letter, digit, or
underscore that is not to be interpreted as part of its name.  If
@var{name} is an array parameter, then the values of each element of
@var{name} is substituted, one element per word.  Otherwise, the
expansion results in one word only; no word splitting is done on the
result.@refill

@item $@{+@var{name}@}
If @var{name} is the name of a set parameter, then substitute 1,
otherwise substitute 0.@refill

@item $@{@var{name}:-@var{word}@}
If @var{name} is set and is non-null then substitute its value;
otherwise substitute @var{word}.@refill

@item $@{@var{name}:=@var{word}@}
If @var{name} is unset or is null then set it to @var{word}; the value
of the parameter is then substituted.@refill

@item $@{@var{name}:?@var{word}@}
If @var{name} is set and is non-null, then substitute its value;
otherwise, print @var{word} and exit from the shell.  If @var{word} is
omitted, then a standard message is printed.@refill

@item $@{@var{name}:+@var{word}@}
If @var{name} is set and is non-null then substitute @var{word};
otherwise substitute nothing.@refill

@item $@{@var{name}#@var{pattern}@}
@itemx $@{@var{name}##@var{pattern}@}
If the @var{pattern} matches the beginning of the value of @var{name},
then substitute the value of @var{name} with the matched portion
deleted; otherwise, just substitute the value of @var{name}.  In the
first form, the smallest matching pattern is preferred; in the second
form, the largest matching pattern is preferred.@refill

@item $@{@var{name}%@var{pattern}@}
@itemx $@{@var{name}%%@var{pattern}@}
If the @var{pattern} matches the end of the value of @var{name}, then
substitute the value of @var{name} with the matched portion deleted;
otherwise, just substitute the value of @var{name}.  In the first form,
the smallest matching pattern is preferred; in the second form, the
largest matching pattern is preferred.@refill

@item $@{#@var{spec}@}
If @var{spec} is one of the above substitutions, substitute the length
in characters of the result instead of the result itself.  If @var{spec}
is an array expression, substitute the number of elements of the
result.@refill

@item $@{^@var{spec}@}
Toggle the value of the @code{RC_EXPAND_PARAM} option for the evaluation
@pindex RC_EXPAND_PARAM, use of
of @var{spec}.  When this option is set, array expansions of the form
@cindex rc, array expansion style
@cindex array expansion, rc style
@samp{foo$@{xx@}bar}, where the parameter @samp{xx} is set to @samp{(a b
c)}, are substituted with @samp{fooabar foobbar foocbar} instead of the
default @samp{fooa b cbar}.@refill

@item $@{=@var{spec}@}
Toggle the value of the @code{SH_WORD_SPLIT} option for the evaluation
@pindex SH_WORD_SPLIT, use of
of @var{spec}.  When this option is set, parameter values are split into
separate words using @code{IFS} as a delimiter before substitution.
@cindex word splitting, sh style
@cindex sh, word splitting style
@vindex IFS, use of
This is done by default in most other shells.@refill

@item $@{~@var{spec}@}
@cindex csh, tilde expansion
@cindex tilde expansion, csh
@pindex CSH_JUNKIE_LOOPS
Toggle the value of the @code{GLOB_SUBST} option for the evaluation of
@var{spec}.  When this option is set, any pattern characters resulting
from the substitution become eligible for file expansion and filename
generation.@refill
@end table

@noindent
If the colon is omitted from one of the above expressions containing a
colon, then the shell only checks whether @var{name} is set or not, not
whether it is null.@refill

@noindent
If the opening brace is directly followed by an opening parenthesis
the string up to the matching closing parenthesis will be taken as a
list of flags.  Where arguments are valid, any character, or the
matching pairs @code{(@dots{})}, @code{@{@dots{}@}}, @code{[@dots{}]},
or @code{<@dots{}>}, may be used in place of the colon as delimiters.
The following flags are supported:

@table @code
@item o
Sort the resulting words in ascending order.

@item O
Sort the resulting words in descending order.

@item i
With @code{o} or @code{O}, makes the sort case-insensitive.

@item L
Converts all letters in the result to lowercase.

@item U
Converts all letters in the result to uppercase.

@item C
Capitalizes the resulting words

@item c
With @code{$@{#@var{name}@}}, count the total number of characters in an
array, as if the elements were concatenated with spaces between
them.@refill

@item w
With @code{$@{#@var{name}@}}, count words in arrays or strings; the
@code{s} flag may be used to set a word delimiter.@refill

@item l:@var{expr}::@var{string1}::@var{string2}:
Pad the resulting words on the left.  Each word will be truncated if
required and placed in a field @var{expr} characters wide.  The space to
the left will be filled with @var{string1} (concatenated as often as
needed), or spaces if @var{string1} is not given.  If both @var{string1}
and @var{string2} are given, this string will be placed exactly once
directly to the left of the resulting word.@refill

@item r:@var{expr}::@var{string1}::@var{string2}:
As @code{l}, but pad the words on the right.

@item j:@var{string}:
Join the words or arrays together using @var{string} as a separator.
Note that this occurs before word splitting by the @code{SH_WORD_SPLIT}
option.@refill

@item s:@var{string}:
Force word splitting (see the option @code{SH_WORD_SPLIT}) at the
separator @var{string}.  Splitting only occurs in places where an array
value is valid.

@item S
(This and all remaining flags are used with the
@code{$@{@dots{}#@dots{}@}} and @code{$@{@dots{}%@dots{}@}} forms).
Search substrings as well as beginnings or ends of strings.@refill

@item I:@var{expr}:
Search the @var{expr}'th match (where @var{expr} evaluates to a number).

@item M
Include the matched portion in the result.

@item R
Include the unmatched portion in the result (the @var{r}est).

@item B
Include the index of the beginning of the match in the result.

@item E
Include the index of the end of the match in the result.

@item N
Include the length of the match in the result.
@end table

@node Command Substitution, Arithmetic Expansion, Parameter Expansion, Expansion
@section Command Substitution
@cindex command substitution
@cindex substitution, command

@noindent
A command enclosed in parentheses preceded by a dollar sign, like so:
@code{$(@dots{})} or quoted with grave accents: @code{`@dots{}`} is
replaced with its standard output.  If the substitution is not enclosed
in double quotes, the output is broken into words using the @code{IFS}
@vindex IFS, use of
parameter.  The substitution @code{$(cat foo)} may be replaced by the
equivalent but faster @code{$(<foo)}.  In either case, if the option
@code{GLOB_SUBST} is set the output is eligible for filename
generation.@refill

@node Arithmetic Expansion, Brace Expansion, Command Substitution, Expansion
@section Arithmetic Expansion
@cindex arithmetic expansion
@cindex expansion, arithmetic

@noindent
A string of the form @code{$[@var{exp}]} is substituted with the value
of the arithmetic expression @var{exp}.  @var{exp} is treated as if it
were within single quotes.  @xref{Arithmetic Evaluation}.@refill

@node Brace Expansion, Filename Generation, Arithmetic Expansion, Expansion
@section Brace Expansion
@cindex brace expansion
@cindex expansion, brace

@noindent
A string of the form @samp{foo@{xx,yy,zz@}bar} is expanded to the
individual words @samp{fooxxbar}, @*@samp{fooyybar}, and @samp{foozzbar}.
Left-to-right order is preserved.  This construct may be nested.
Malformed brace expansion expressions, including expressions without a
comma, are left unchanged by the shell.@refill

@noindent
An expression of the form @code{@{x-y@}}, where @code{x} and @code{y}
are single characters, is expanded to every character between @code{x}
and @code{y}, inclusive.@refill

@node Filename Generation,  , Brace Expansion, Expansion
@section Filename Generation
@cindex filename generation

@noindent
If a word contains an unquoted instance of one of the characters
@cindex globbing
@code{*}, @code{|}, @code{<}, @code{[}, or @code{?}, it is regarded as a
pattern for filename generation, unless the @code{NO_GLOB} option is
@pindex NO_GLOB, use of
set.  If the @code{EXTENDED_GLOB} option is set, the @code{^} and
@pindex EXTENDED_GLOB, use of
@code{#} characters also denote a pattern; otherwise (except for an
initial @code{~}, @xref{Filename Expansion}) they are not
treated specially by the shell.  The word is replaced with a list of
sorted filenames that match the pattern.  If no matching pattern is
found, the shell gives an error message, unless the @code{NULL_GLOB}
@pindex NULL_GLOB, use of
option is set, in which case the word is deleted; or unless the
@code{NO_NOMATCH} option is set, in which case the word is left
@pindex NO_NOMATCH, use of
unchanged.  In filename generation, the character @code{/} must be
matched explicitly; also, a @code{.} must be matched explicitly at the
beginning of a pattern or after a @code{/}, unless the @code{GLOB_DOTS}
@pindex GLOB_DOTS, use of
option is set.  No filename generation pattern matches the files
@file{.} or @file{..}.  In other instances of pattern matching, the
@code{/} and @code{.} are not treated specially.@refill

@table @code
@item *
Matches any string, including the null string.

@item ?
Matches any character.

@item [@dots{}]
Matches any of the enclosed characters.

@item [^@dots{}]
Matches any character except the enclosed characters.  @code{!@dots{}}
is the same.

@item <x-y>
Matches any number in the range @code{x} to @code{y}, inclusive.  If
@code{x} is omitted, the number must be less than or equal to @code{y}.
If @code{y} is omitted, the number must be greater than or equal to
@code{x}.  A pattern of the form @code{<->} or simply @code{<>} matches
any number.@refill

@item ^x
Matches anything except the pattern @code{x}.

@item x|y
Matches either @code{x} or @code{y}.

@item x#
Matches zero or more occurrences of the pattern @code{x}.

@item x##
Matches one or more occurrences of the pattern @code{x}.
@end table

@noindent
Parentheses may be used for grouping.  Note that the @code{|} character
must be within parentheses, so that the lexical analyzer does not think
it is a pipe character.  Also note that @code{/} has a higher precedence
than @code{^}; that is:@refill

@code{ls ^foo/bar}

@noindent
will search directories in @file{.} except @file{./foo} for a file named
@file{bar}.@refill

@noindent
A pathname component of the form @code{(@var{foo}/)#} matches a path
consisting of zero or more directories matching the pattern @var{foo}.
As a shorthand, @code{**/} is equivalent to @code{(*/)#}.  Thus:@refill

@code{ls (*/)#bar}

@noindent
or

@code{ls **/bar}

@noindent
does a recursive directory search for files named @file{bar}.

@noindent
If used for filename generation, a pattern may contain an exclusion
@cindex exclusion, globbing
@cindex globbing, excluding patterns
specifier.  Such patterns are of the form @code{@var{pat1}~@var{pat2}}.
This pattern will generate all files matching @var{pat1}, but which do
not match @var{pat2}.  For example, @samp{*.c~lex.c} will match all
files ending in @file{.c}, except the file @file{lex.c}.  This may
appear inside parentheses.  Note that @code{~} has higher precedence
than @code{|}, so that @samp{pat1|pat2~pat3} matches any time that
@var{pat1} matches, or if @var{pat2} matches while @var{pat3} does not.
Note also that any @code{/} characters are not treated specially in the
exclusion specifier, so that a @code{*} will match multiple path
segments if they appear in the pattern to the left of the
@code{~}.@refill 

@noindent
Patterns used for filename generation may also end in a list of
@cindex qualifiers, globbing
@cindex globbing, qualifiers
qualifiers enclosed in parentheses.  The qualifiers specify which
filenames that otherwise match the given pattern will be inserted in the
argument list.  A qualifier may be any one of the following:

@table @code
@item /
Directories

@item .
Plain files

@item @@
Symbolic links

@item =
Sockets

@item p
Named pipes (FIFOs)

@item *
Executable plain files (0100)

@item %
Device files (character or block special)

@item %b
Block special files

@item %c
Character special files

@item r
Readable files (0400)

@item w
Writable files (0200)

@item x
Executable files (0100)

@item R
World-readable files (0004)

@item W
World-writable files (0002)

@item X
World-executable files (0001)

@item s
Setuid files (04000)

@item S
Setgid files (02000)

@item d@var{dev}
Files on the device @var{dev}

@item l[+-]@var{ct}
Files having a link count less than (@code{-}), more than (@code{+}), or
equal to @var{ct}.@refill

@item U
Files owned by the effective user id.

@item G
Files owned by the effective group id.

@item u@var{id}
Files owned by user @var{id} if @var{id} is a number.  If not, the
character after the @code{u} will be used as a separator and the string
between it and the next matching separator (@code{(}, @code{[},
@code{@{}, and @code{<} match @code{)}, @code{]}, @code{@}}, and
@code{>} respectively; any other character matches itself) will be taken
as a user name and translated into the corresponding user id (e.g.@:
@code{u:foo:} or @code{u[foo]} for user @code{foo}).@refill

@item g@var{id}
Like @code{u@var{id}} but with group ids or names.

@item a[+-]@var{n}
Files accessed within last @var{n} days (@code{-}), more than @var{n}
days ago (@code{+}), or exactly @var{n} days ago.@refill

@item m[+-]@var{n}
Files modified within last @var{n} days (@code{-}), more than @var{n}
days ago (@code{+}), or exactly @var{n} days ago.@refill

@item c[+-]@var{n}
Files whose inode changed within last @var{n} days (@code{-}), more than
@var{n} days ago (@code{+}), or exactly @var{n} days ago.  If any of
the flags @code{a}, @code{m}, or @code{c} is directly followed by a @code{M},
@code{w}, @code{h}, or @code{m} (e.g.@: @code{mh+5}) the check is
performed in units of months (of 30 days), weeks, hours, or minutes
respectively.@refill

@item L[+-]@var{n}
Files less than @var{n} bytes (@code{-}), more than @var{n} bytes
(@code{+}), or exactly @var{n} bytes in length.@refill

@item ^
Negates all qualifiers following it.

@item -
Toggles between making the qualifiers work on symbolic links (the
default), and the files they point to.

@item M
Sets the @code{MARK_DIRS} option for the current pattern.
@pindex MARK_DIRS, setting in pattern

@item T
Appends a trailing qualifier mark to the file names, analogous to the
@code{LIST_TYPES}, for the current pattern (overrides @code{M}).@refill

@item N
Sets the @code{NULL_GLOB} option for the current pattern.
@pindex NULL_GLOB, setting in pattern

@item D
Sets the @code{GLOB_DOTS} option for the current pattern.
@pindex GLOB_DOTS, setting in pattern
@end table

@noindent
More than one of these lists can be combined, separated by commas; the
whole list matches if at least one of the sublists matches (they are
or'ed, the qualifiers in the sublists are and'ed).  A @code{/} at the
end of a pattern is equivalent to @code{(/)}.@refill

@noindent
If a @code{:} appears in a qualifier list, the remainder of the
expression in parentheses is interpreted as a modifier
(@xref{Modifiers}).  Note that each modifier must be introduced by a
separate @code{:}.  Note also that the result after modification does
not have to be an existing file.  The name of any existing file can be
followed by a modifier of the form @code{(:@dots{})} even if no filename
generation is performed.@refill

@noindent
Thus:

@code{ls *(-/)}

@noindent
lists all directories and symbolic links that point to directories, and

@code{ls *(%W)}

@noindent
lists all world-writable device files in the current directory, and

@code{ls *(W,X)}

@noindent
lists all files in the current directory that are world-writable or
world-executable, and

@code{echo /tmp/foo*(u0^@@:t)}

@noindent
outputs the basename of all root-owned files beginning with the string
@samp{foo} in @file{/tmp}, ignoring symlinks, and@refill

@code{ls *.*~(lex|parse).[ch](^D^l1)}

@noindent
lists all files having a link count of one whose names contain a dot
(but not those starting with a dot, since @code{GLOB_DOTS} is explicitly
switched off) except for @file{lex.c}, @file{lex.h}, @file{parse.c}, and
@file{parse.h}.@refill

@node Redirection, Command Execution, Expansion, Top
@chapter Redirection
@cindex redirection

@noindent
Before a command is executed, its input and output may be redirected.
@cindex file descriptors
@cindex descriptors, file
The following may appear anywhere in a simple command or may precede or
follow a complex command.  Substitution occurs before @var{word} is used
except as noted below.  If the result of substitution on @var{word}
produces more than one filename, redirection occurs for each separate
filename in turn.@refill

@table @code
@item <@var{word}
Open file @var{word} as standard input.

@item >@var{word}
Open file @var{word} as standard output.  If the file does not exist
then it is created.  If the file exists, and the @code{NO_CLOBBER}
@pindex NO_CLOBBER, use of
option is set, this causes an error; otherwise, it is truncated to zero
length.@refill

@item >!@var{word}
Same as @code{>}, except that the file is truncated to zero length if it
exists, even if @code{NO_CLOBBER} is set.@refill

@item >>@var{word}
Open file @var{word} as standard output.  If the file exists then output
is appended to it.  If the file does not exist, and the
@code{NO_CLOBBER} option is set, this causes an error; otherwise, the
file is created.@refill

@item >>!@var{word}
Same as @code{>>}, except that the file is created if it does not exist,
even if @code{NO_CLOBBER} is set.@refill

@item <<[-]@var{word}
The shell input is read up to a line that is the same as @var{word}, or
to an end-of-file.  No parameter substitution, command substitution or
filename generation is performed on @var{word}.  The resulting document,
called a @dfn{here-document}, becomes the standard input.  If any
character of @var{word} is quoted with single or double quotes or a
@code{\}, no interpretation is placed upon the characters of the
document.  Otherwise, parameter and command substitution occurs,
@code{\} followed by a newline is removed, and @code{\} must be used to
quote the characters @code{\}, @code{$}, @code{`}, and the first
character of @var{word}.  If @code{<<-} is used, then all leading tabs
are stripped from @var{word} and from the document.@refill

@item <<<@var{word}
Open a file containing @var{word}, after expansion, as standard input.

@item <&@var{digit}
The standard input is duplicated from file descriptor @var{digit} (see
@code{dup(2)}).  Similarly for standard output using
@code{>&@var{digit}}.@refill

@item >&@var{word}
Same as @code{>@var{word} 2>&1}.

@item >>&@var{word}
Same as @code{>>@var{word} 2>&1}.

@item <&-
Close the standard input.

@item >&-
Close the standard output.

@item <&p
The input from the coprocess is moved to the standard input.

@item >&p
The output to the coprocess is moved to the standard output.
@end table

@noindent
If one of the above is preceded by a digit, then the file descriptor
referred to is that specified by the digit (instead of the default 0 or
1).  The order in which redirections are specified is significant.  The
shell evaluates each redirection in terms of the (@var{file descriptor},
@var{file}) association at the time of evaluation.  For example:@refill

@code{@dots{} 1>@var{fname} 2>&1}

@noindent
first associates file descriptor 1 with file @var{fname}.  It then
associates file descriptor 2 with the file associated with file
descriptor 1 (that is, @var{fname}).  If the order of redirections were
reversed, file descriptor 2 would be associated with the terminal
(assuming file descriptor 1 had been) and then file descriptor 1 would
be associated with file @var{fname}.@refill

@noindent
If the user tries to open a file descriptor for writing more than once,
the shell opens the file descriptor as a pipe to a process that copies
its input to all the specified outputs, similar to @code{tee(1)}.  Thus:

@code{date >foo >bar}

@noindent
writes the date to two files, named @file{foo} and @file{bar}.  Note
that a pipe is an implicit indirection; thus@refill

@code{date >foo | cat}

@noindent
writes the date to the file @file{foo}, and also pipes it to @code{cat}.

@noindent
If the user tries to open a file descriptor for reading more than once,
the shell opens the file descriptor as a pipe to a process that copies
all the specified inputs to its output in the order specified, similar
to @code{cat(1)}.  Thus

@code{sort <foo <fubar}

@noindent
or even

@code{sort <f@{oo,ubar@}}

@noindent
is equivalent to @samp{cat foo fubar | sort}.  Similarly, you can do

@code{echo exit 0 >> *.sh}

Note that a pipe is an implicit indirection; thus

@code{cat bar | sort <foo}

@noindent
is equivalent to @samp{cat bar foo | sort} (note the order of the inputs).

@noindent
If a simple command consists of one or more redirection operators and
zero or more parameter assignments, but no command name, the command
@code{cat} is assumed.  Thus

@code{< file}

@noindent
prints the contents of @code{file}.

@noindent
If a command is followed by @code{&} and job control is not active, then
the default standard input for the command is the empty file
@file{/dev/null}.  Otherwise, the environment for the execution of a
command contains the file descriptors of the invoking shell as modified
by input/output specifications.@refill

@node Command Execution, Functions, Redirection, Top
@chapter Command Execution
@cindex command execution
@cindex execution, of commands

@noindent
If a command name contains no slashes, the shell attempts to locate it.
If there exists a shell function by that name, the function is invoked
as described below (@pxref{Functions}).  If there exists a shell builtin
by that name, the builtin is invoked.

@noindent
Otherwise, the shell searches each element of @code{path} for a directory
@vindex path, use of
containing an executable file by that name.  If the search is
unsuccessful, the shell prints an error message and returns a nonzero
exit status.

@noindent
If execution fails because the file is not in executable format, and the
file is not a directory, it is assumed to be a shell script.
@code{/bin/sh} is spawned to execute it.  If the program is a file
beginning with @code{#!}, the remainder of the first line specifies an
interpreter for the program.  The shell will execute the specified
interpreter on operating systems that do not handle this executable
format in the kernel.@refill

@node Functions, Jobs & Signals, Command Execution, Top
@chapter Functions
@cindex functions

@noindent
The @code{function} reserved word is used to define shell functions.
@findex function
Shell functions are read in and stored internally.  Alias names are
resolved when the function is read.  Functions are executed like
commands with the arguments passed as positional parameters.@refill

@noindent
Functions execute in the same process as the caller and share all files
and the present working directory with the caller.  A trap on
@code{EXIT} set inside a function is executed after the function
completes in the environment of the caller.@refill

@noindent
The @code{return} builtin is used to return from function calls.
@findex return, use of

@noindent
Function identifiers can be listed with the @code{functions} builtin.
@findex functions, use of
@findex unfunction, use of
Functions can be undefined with the @code{unfunction} builtin.@refill

@noindent
The following functions, if defined, have special meaning to the shell:

@table @code
@item chpwd
Executed whenever the current working directory is changed.
@findex chpwd

@item precmd
Executed before each prompt.
@findex precmd

@item periodic
If the parameter @code{PERIOD} is set, this function is executed every
@vindex PERIOD
@findex periodic
@code{PERIOD} seconds, just before a prompt.@refill

@cindex signals, trapping
@cindex trapping signals
@item TRAP@var{xxx}
If defined and non-null, this function will be executed whenever the
shell catches a signal @code{SIG@var{xxx}}, where @var{xxx} is a signal
name as specified for the @code{kill} builtin (@pxref{Shell Builtin
Commands}).  In addition, @code{TRAPZERR} is executed whenever a command
@findex TRAPZERR
has a non-zero exit status, @code{TRAPDEBUG} is executed after each
@findex TRAPDEBUG
command, and @code{TRAPEXIT} is executed when the shell exits, or when
@findex TRAPEXIT
the current function exits if defined inside a function.  If a function
of this form is defined and null, the shell and processes spawned by it
will ignore @code{SIG@var{xxx}}.@refill
@end table

@node Jobs & Signals, History, Functions, Top
@chapter Jobs & Signals
@cindex jobs

@noindent
If the @code{MONITOR} option is set, an interactive shell associates a
@pindex MONITOR, use of
@dfn{job} with each pipeline.  It keeps a table of current jobs,
@findex jobs, use of
printed by the @code{jobs} command, and assigns them small integer
numbers.  When a job is started asynchronously with @code{&}, the shell
prints a line which looks like:@refill

@code{[1] 1234}

@noindent
indicating that the job which was started asynchronously was job number
1 and had one (top-level) process, whose process id was 1234.

@noindent
If you are running a job and wish to do something else you may hit the
key @code{^Z} (control-Z) which sends a @code{TSTP} signal to the current
@cindex jobs, suspending
@cindex suspending jobs
@kindex CTRL-Z
job.  The shell will then normally indicate that the job has been
@dfn{suspended}, and print another prompt.  You can then manipulate the
state of this job, putting it into the background with the @code{bg}
@findex bg, use of
command, or run some other commands and then eventually bring the job
back into the foreground with the foreground command @code{fg}.  A
@findex fg, use of
@code{^Z} takes effect immediately and is like an interrupt in that
pending output and unread input are discarded when it is typed.@refill

@noindent
A job being run in the background will suspend if it tries to read from
@cindex jobs, background, IO
@cindex background jobs, IO
the terminal.  Background jobs are normally allowed to produce output,
but this can be disabled by giving the command @code{stty tostop}.  If
you set this tty option, then background jobs will suspend when they try
to produce output, just as they do when they try to read input.@refill

@noindent
There are several ways to refer to jobs in the shell.  A job can be
@cindex jobs, referring to
@cindex referring to jobs
referred to by the process id of any process of the job or by one of the
following:

@table @code
@item %@var{number}
The job with the given number.

@item %@var{string}
Any job whose command line begins with @var{string}.

@item %?@var{string}
Any job whose command line contains @var{string}.

@item %%
Current job.

@item %+
Equivalent to @code{%%}.

@item %-
Previous job.
@end table

@noindent
The shell learns immediately whenever a process changes state.  It
normally informs you whenever a job becomes blocked so that no further
progress is possible.  If @code{notify} is not set, it waits until just
@findex notify, use of
before it prints a prompt before it informs you.@refill

@noindent
When the monitor mode is on, each background job that completes triggers
any trap set for @code{CHLD}.

@noindent
When you try to leave the shell while jobs are running or suspended, you
will be warned that @samp{You have suspended (running) jobs}.  You may
use the @code{jobs} command to see what they are.  If you do this or
immediately try to exit again, the shell will not warn you a second
time; the suspended jobs will be terminated, and the running jobs will
be sent a @code{SIGHUP} signal.  To avoid having the shell terminate the
running jobs, either use the @code{nohup(1)} command or the
@code{disown} builtin (@pxref{Shell Builtin Commands}).@refill
@cindex jobs, disowning
@findex disown, use of
@cindex disowning jobs

@noindent
The @code{INT} and @code{QUIT} signals for an invoked command are
@cindex signals
ignored if the command is followed by @code{&} and the job @code{monitor}
option is not active.  Otherwise, signals have the values inherited by
the shell from its parent (but @xref{Functions}, for the
@code{TRAP@var{xxx}} special functions).@refill

@node History, Arithmetic Evaluation, Jobs & Signals, Top
@chapter History
@cindex history

@noindent
History substitution allows you to use words from previous command lines
in the command line you are typing.  This simplifies spelling
corrections and the repetition of complicated commands or arguments.
Command lines are saved in the history list, the size of which is
controlled by the @code{HISTSIZE} variable.  The most recent command is
@vindex HISTSIZE, use of
retained in any case.  A history substitution begins with a @code{!} and
may occur anywhere on the command line; history substitutions do not
nest.  The @code{!} can be escaped with @code{\} to suppress its special
meaning.  Single or double quotes will @emph{not} work for this.@refill

@noindent
Input lines containing history substitutions are echoed on the terminal
after being expanded, but before any other substitutions take place or
the command gets executed.

@menu
* Event Designators::		
* Word Designators::		
* Modifiers::			
@end menu

@node Event Designators, Word Designators,  , History
@section Event Designators
@cindex history event designators
@cindex event designators, history

@noindent
An event designator is a reference to a command-line entry in the
history list.

@table @code
@item !
Start a history substitution, except when followed by a blank, newline,
@code{=}, or @code{(}.

@item !!
Refer to the previous command.  By itself, this substitution repeats the
previous command.

@item !n
Refer to command line @var{n}.

@item !-n
Refer to the current command line minus @var{n}.

@item !str
Refer to the most recent command starting with @var{str}.

@item !?@var{str}[?]
Refer to the most recent command containing @var{str}.

@item !#
Refer to the current command line typed in so far.

@item !@{@dots{}@}
Insulate a history reference from adjacent characters (if necessary).
@end table

@node Word Designators, Modifiers, Event Designators, History
@section Word Designators
@cindex history word designators
@cindex word designators, history

@noindent
A word designator indicates which word or words of a given command line
will be included in a history reference.  A @code{:} separates the event
specification from the word designator.  It can be omitted if the word
designator begins with a @code{,}, @code{$}, @code{*}, @code{-} or
@code{%}.  Word designators include:@refill

@table @code
@item 0
The first input word (command).

@item @var{n}
The @var{n}'th argument.

@item ^
The first argument, that is, @code{1}.

@item $
The last argument.

@item %
The word matched by (the most recent) @code{?@var{str}} search.

@item @var{x}-@var{y}
A range of words;  @code{-@var{y}} abbreviates @code{0-@var{y}}.

@item *
All the arguments, or a null value if there is just one word in the
event.

@item @var{x}*
Abbreviates @code{@var{x}-$}.

@item @var{x}
Like @code{@var{x}*} but omitting word @code{$}.
@end table

@noindent
Note that a @code{%} word designator will only work when used as
@code{!%}, @code{!:%}, or @code{!?@var{str}?:%}, and only when used
after a @code{?!} substitution.  Anything else will result in an error,
although the error may not be the most obvious one.@refill

@node Modifiers,  , Word Designators, History
@section Modifiers
@cindex modifiers, history
@cindex history modifiers

@noindent
After the optional word designator, you can add a sequence of one or
more of the following modifiers, each preceded by a @code{:}.  These
modifiers also work on the result of filename and parameter
expansion.@refill

@table @code
@item h
Remove a trailing pathname component, leaving the head.

@item r
Remove a trailing suffix of the form @code{.@var{xxx}}, leaving the
basename.@refill

@item e
Remove all but the suffix.

@item t
Remove all leading pathname components, leaving the tail.

@item &
Repeat the previous substitution.

@item g
Apply the change to the first occurrence of a match in each word, by
prefixing the above (for example, @code{g&}).

@item p
Print the new command but do not execute it.

@item q
Quote the substituted words, escaping further substitutions.

@item x
Like @code{q}, but break into words at each blank.

@item l
Convert the words to all lowercase.

@item u
Convert the words to all uppercase.

@item f
Repeats the immediately-following (without a colon) modifier until the
resulting word doesn't change any more.  This modifier and the following
four only work with parameter and filename expansion.

@item F:@var{expr}:
Like @code{f}, but repeats only @var{n} times if the expression
@var{expr} evaluates to @var{n}.  Any character can be used instead of
the @code{:}, with the exception that if @code{(}, @code{[}, or
@code{@{} is used as the opening delimiter, the closing delimiter must
be @code{)}, @code{]}, or @code{@}} respectively.@refill

@item w
Makes the immediately-following modifier work on each word in the
string.

@item W:@var{sep}:
Like @code{w}, but words are considered to be the parts of the string
that are separated by @var{sep}.  Delimiters are handled as in @code{F}
above.@refill

@item s/@var{l}/@var{r}[/]
Substitute @var{r} for @var{l}.

@noindent
Unless preceded by a @code{g}, the substitution is done only for the
first string that matches @var{l}.@refill

@noindent
The left-hand side of substitutions are not regular expressions, but
character strings.  Any character can be used as the delimiter in place
of @code{/}.  A backslash quotes the delimiter character.  The character
@code{&}, in the right-hand side, is replaced by the text from the
left-hand side.  The @code{&} can be quoted with a backslash.  A null
@var{l} uses the previous string either from a @var{l} or from a
contextual scan string @var{s} from @code{!?@var{s}}.  You can omit the
rightmost delimiter if a newline immediately follows @var{r}; the
rightmost @code{?} in a context scan can similarly be omitted.@refill
@end table

@noindent
By default, a history reference with no event specification refers to
@cindex csh, history style
@cindex history, csh style
the same line as the last history reference on that command line, unless
it is the first history reference in a command.  In that case, a history
reference with no event specification always refers to the previous
command.  However, if the option @code{CSH_JUNKIE_HISTORY} is set, then
a history reference with no event specification will @var{always} refer
to the previous command.  For example, @code{!!:1} will always refer to
the first word of the previous command and @code{!!$} will always refer
to the last word of the previous command.  If @code{CSH_JUNKIE_HISTORY}
is set, then @code{!:1} and @code{!$} will function in the same manner
as @code{!!:1} and @code{!!$}, respectively.
However, if @code{CSH_JUNKIE_HISTORY} is unset, then @code{!:1} and
@code{!$} will refer to the first and last words respectively of the
last command referenced on the current command line.  However, if they
are the first history reference on the command line, then they refer to
the previous command.@refill

@noindent
The character sequence @samp{^foo^bar} repeats the last command,
replacing the string @samp{foo} with the string @samp{bar}.@refill

@noindent
If the shell encounters the character sequence @code{!"} in the input,
@cindex history, disabling
@cindex disabling history
the history mechanism is temporarily disabled until the current list is
fully parsed.  The @code{!"} is removed from the input, and any
subsequent @code{!} characters have no special significance.@refill

@noindent
A less convenient but more comprehensible form of command history
support is provided by the @code{fc} builtin 
@findex fc, use of
(@pxref{Shell Builtin Commands}).

@node Arithmetic Evaluation, Conditional Expressions, History, Top
@chapter Arithmetic Evaluation
@cindex arithmetic evaluation
@cindex evaluation, arithmetic

@noindent
An ability to perform integer arithmetic is provided with the builtin
@code{let}.  Evaluations are performed using @emph{long} arithmetic.
Constants are of the form @code{[@var{base}#]@var{n}} where @var{base}
is a decimal number between two and thirty-six representing the
arithmetic base and @var{n} is a number in that base (for example,
@code{16#ff} is 255 in hexadecimal).  If @var{base} is omitted then base
10 is used.  For backwards compatibility the form @code{[16]ff} is also
accepted.@refill

@noindent
An arithmetic expression uses nearly the same syntax, precedence, and
@cindex arithmetic operators
@cindex operators, arithmetic
associativity of expressions in C.  The following operators are
supported (listed in decreasing order of precedence):

@table @code
@item + - ! ~ ++ --
Unary plus/minus, logical NOT, complement, @{pre,post@}@{in,de@}crement

@item &
Logical AND

@item ^
Logical XOR

@item |
Logical OR

@item * / % **
Multiplication, division, remainder, exponentiation

@item + -
Addition, subtraction

@item << >>
Logical shift left, shift right

@item < > <= >=
Comparison

@item == !=
Equality and inequality

@item &&
Boolean AND

@item || ^^
Boolean OR, XOR

@item ? :
Ternary operator

@item = += -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= **=
Assignment

@item ,
Comma operator
@end table

@noindent
The operators @code{&&}, @code{||}, @code{&&=}, and @code{||=} are
short-circuiting, and only one of the latter two expressions in a
ternary operator is evaluated.  Note the precedence of the logical AND,
OR, and XOR operators.@refill

@noindent
An expression of the form @code{#\x} where @code{x} is any character
gives the ASCII value of this character.  An expression of the form
@code{#foo} gives the ASCII value of the first character of the value of
the parameter @code{foo}.@refill

@noindent
Named parameters can be referenced by name within an arithmetic
expression without using the parameter substitution syntax, but if it is
an array with a subscript the leading @code{$} is needed.

@noindent
An internal integer representation of a named parameter can be specified
with the @code{integer} builtin.  Arithmetic evaluation is performed on
@cindex parameters, integer
@cindex integer parameters
@findex integer, use of
the value of each assignment to a named parameter declared integer in
this manner.@refill

@noindent
Since many of the arithmetic operators require quoting, an alternative
form of the @code{let} command is provided.  For any command which
@findex let, use of
begins with a @code{((}, all the characters until a matching @code{))}
are treated as a quoted expression.  More precisely, @code{(( @dots{} ))} is
equivalent to @code{let "@dots{}"}.@refill

@node Conditional Expressions, Zsh Line Editor, Arithmetic Evaluation, Top
@chapter Conditional Expressions
@cindex conditional expressions
@cindex expressions, conditional

@noindent
A @dfn{conditional expression} is used with the @code{[[} compound
command to test attributes of files and to compare strings.  Each
expression can be constructed from one or more of the following unary or
binary expressions:@refill

@table @code
@item -a @var{file}
True if @var{file} exists.

@item -b @var{file}
True if @var{file} exists and is a block special file.

@item -c @var{file}
True if @var{file} exists and is a character special file.

@item -d @var{file}
True if @var{file} exists and is a directory.

@item -e @var{file}
True if @var{file} exists.

@item -f @var{file}
True if @var{file} exists and is an ordinary file.

@item -g @var{file}
True if @var{file} exists and has its setgid bit set.

@item -h @var{file}
True if @var{file} exists and is a symbolic link.

@item -k @var{file}
True if @var{file} exists and has its sticky bit set.

@item -n @var{string}
True if length of @var{string} is non-zero.

@item -o @var{option}
True if option named @var{option} is on.

@item -p @var{file}
True if @var{file} exists and is a FIFO special file or a pipe.

@item -r @var{file}
True if @var{file} exists and is readable by the current process.

@item -s @var{file}
True if @var{file} exists and has size greater than zero.

@item -t @var{fd}
True if file descriptor number @var{fd} is open and associated with a
terminal device (note: @var{fd} is not optional).@refill

@item -u @var{file}
True if @var{file} exists and has its setuid bit set.

@item -w @var{file}
True if @var{file} exists and is writable by current process.

@item -x @var{file}
True if @var{file} exists and is executable by current process.  If
@var{file} exists and is a directory, then the current process has
permission to search in the directory.@refill

@item -z @var{string}
True if length of @var{string} is zero.

@item -L @var{file}
True if @var{file} exists and is a symbolic link.

@item -O @var{file}
True if @var{file} exists and is owned by the effective user id of this
process.

@item -G @var{file}
True if @var{file} exists and its group matches the effective group id
of this process.

@item -S @var{file}
True if @var{file} exists and is a socket.

@item @var{file1} -nt @var{file2}
True if @var{file1} exists and is newer than @var{file2}.

@item @var{file1} -ot @var{file2}
True if @var{file1} exists and is older than @var{file2}.

@item @var{file1} -ef @var{file2}
True if @var{file1} and @var{file2} exist and refer to the same file.

@item @var{string} = @var{pattern}
True if @var{string} matches @var{pattern}.

@item @var{string} != @var{pattern}
True if @var{string} does not match @var{pattern}.

@item @var{string1} < @var{string2}
True if @var{string1} comes before @var{string2} based on ASCII value of
their characters.@refill

@item @var{string1} > @var{string2}
True if @var{string1} comes after @var{string2} based on ASCII value of
their characters.@refill

@item @var{exp1} -eq @var{exp2}
True if @var{exp1} is equal to @var{exp2}.

@item @var{exp1} -ne @var{exp2}
True if @var{exp1} is not equal to @var{exp2}.

@item @var{exp1} -lt @var{exp2}
True if @var{exp1} is less than @var{exp2}.

@item @var{exp1} -gt @var{exp2}
True if @var{exp1} is greater than @var{exp2}.

@item @var{exp1} -le @var{exp2}
True if @var{exp1} is less than or equal to @var{exp2}.

@item @var{exp1} -ge @var{exp2}
True if @var{exp1} is greater than or equal to @var{exp2}.

@item ( @var{exp} )
True if @var{exp} is true.

@item ! @var{exp}
True if @var{exp} is false.

@item @var{exp1} && @var{exp2}
True if @var{exp1} and @var{exp2} are both true.

@item @var{exp1} || @var{exp2}
True if either @var{exp1} or @var{exp2} is true.
@end table

@noindent
In each of the above expressions, if @var{file} is of the form
@samp{/dev/fd/@var{n}}, where @var{n} is an integer, then the test is
applied to the open file whose descriptor number is @var{n}, even if
the underlying system does not support the @file{/dev/fd}
directory.@refill

@node Zsh Line Editor, Parameters, Conditional Expressions, Top
@chapter Zsh Line Editor
@cindex line editor
@cindex editor, line

@noindent
If the @code{ZLE} option is set (it is by default) and the shell input is
@pindex ZLE, use of
attached to the terminal, the user is allowed to edit command lines.@refill

@noindent
There are two display modes.  The first, multiline mode, is the default.
It only works if the @code{TERM} parameter is set to a valid terminal
@vindex TERM
type that can move the cursor up.  The second, single line mode, is used
if @code{TERM} is invalid or incapable of moving the cursor up, or if
the @code{SINGLE_LINE_ZLE} option is set.  This mode is similar to ksh,
@pindex SINGLE_LINE_ZLE, use of
@cindex ksh, editor mode
@cindex editor, modes
and uses no termcap sequences.  If @code{TERM} is @samp{emacs}, the
@code{ZLE} option will be unset by the shell.@refill

@noindent
Command bindings may be set using the @code{bindkey} builtin.  There are
@cindex bindings, key
@cindex key bindings
two keymaps---the main keymap and the alternate keymap.  The alternate
keymap is bound to vi command mode.  The main keymap is bound to emacs
mode by default.  To bind the main keymap to vi insert mode, use
@code{bindkey -v}.  However, if either of
@findex bindkey, use of
the @code{VISUAL} or @code{EDITOR} environment variables contains the
@vindex VISUAL
@vindex EDITOR
string @samp{vi} when the shell starts up the main keymap will be bound
to vi insert mode by default.@refill

@noindent
The following is a list of all the key commands and their default
bindings in emacs and vi command mode.

@menu
* Movement::			
* History Control::		
* Modifying Text::		
* Arguments::			
* Completion::			
* Miscellaneous::		
@end menu

@node Movement, History Control,  , Zsh Line Editor
@section Movement

@table @code
@item vi-backward-blank-word (unbound) (@kbd{B})
@kindex B
Move backward one word, where a word is defined as a series of non-blank
characters.
@tindex vi-backward-blank-word

@item backward-char (@kbd{^B} @kbd{ESC-[D})
@tindex backward-char
@kindex CTRL-B
@kindex ESC-[D
Move backward one character.

@item vi-backward-char (unbound) (@kbd{h})
@tindex vi-backward-char
@kindex ESC-B
@kindex ESC-b
Move backward one character, without changing lines.

@item backward-word (@kbd{ESC-B} @kbd{ESC-b})
@tindex backward-word
Move to the beginning of the previous word.

@item emacs-backward-word
@tindex emacs-backward-word
Move to the beginning of the previous word.

@item vi-backward-word (unbound) (@kbd{b})
@tindex vi-backward-word
@kindex b
Move to the beginning of the previous word, vi-style.

@item beginning-of-line (@kbd{^A}) (@kbd{0})
@tindex beginning-of-line
@kindex CTRL-A
@kindex 0
Move to the beginning of the line.  If already at the beginning of the
line, move to the beginning of the previous line, if any.

@item vi-beginning-of-line
@tindex vi-beginning-of-line
Move to the beginning of the line, without changing lines.

@item end-of-line (@kbd{^E})
@tindex end-of-line
@kindex CTRL-E
Move to the end of the line.  If already at the end of the line, move to
the end of the next line, if any.

@item vi-end-of-line (unbound) (@kbd{$})
@tindex vi-end-of-line
@kindex $
Move to the end of the line.

@item vi-forward-blank-word (unbound) (@kbd{W})
@tindex vi-forward-blank-word
@kindex W
Move forward one word, where a word is defined as a series of non-blank
characters.

@item vi-forward-blank-word-end (unbound) (@kbd{E})
@tindex vi-forward-blank-word-end
@kindex E
Move to the end of the current word, or, if at the end of the current
word, to the end of the next word, where a word is defined as a series
of non-blank characters.

@item forward-char (@kbd{^F} @kbd{ESC-[C})
@tindex forward-char
@kindex CTRL-F
@kindex ESC-[C
Move forward one character.

@item vi-forward-char (unbound) (@key{SPACE} @kbd{l})
@tindex vi-forward-char
@kindex l
@kindex SPACE
Move forward one character.

@item vi-find-next-char (@kbd{^X^F}) (@kbd{f})
@tindex vi-find-next-char
@kindex CTRL-X CTRL-F
@kindex f
Read a character from the keyboard, and move to the next occurrence of
it in the line.

@item vi-find-next-char-skip (unbound) (@kbd{t})
@tindex vi-find-next-char-skip
@kindex t
Read a character from the keyboard, and move to the position just before
the next occurrence of it in the line.

@item vi-find-prev-char (unbound) (@kbd{F})
@tindex vi-find-prev-char
@kindex F
Read a character from the keyboard, and move to the previous occurrence
of it in the line.

@item vi-find-prev-char-skip (unbound) (@kbd{T})
@tindex vi-find-prev-char-skip
@kindex T
Read a character from the keyboard, and move to the position just after
the previous occurrence of it in the line.

@item vi-first-non-blank (unbound) (@kbd{^})
@tindex vi-first-non-blank
@kindex ^
Move to the first non-blank character in the line.

@item vi-forward-word (unbound) (@kbd{w})
@tindex vi-forward-word
@kindex w
Move forward one word, vi-style.

@item forward-word (@kbd{ESC-F} @kbd{ESC-f})
@tindex forward-word
@kindex ESC-F
@kindex ESC-f
Move to the beginning of the next word.  The editor's idea of a word is
specified with the @code{WORDCHARS} parameter.@refill

@item emacs-forward-word
@tindex emacs-forward-word
Move to the end of the next word.

@item vi-forward-word-end (unbound) (@kbd{e})
@tindex vi-forward-word-end
@kindex e
Move to the end of the next word.

@item vi-goto-column (@kbd{ESC-|}) (@kbd{|})
@tindex vi-goto-column
@kindex ESC-|
@kindex |
Move to the column specified by the numeric argument.

@item vi-goto-mark (unbound) (@kbd{`})
@tindex vi-goto-mark
@kindex `
Move to the specified mark.

@item vi-goto-mark-line (unbound) (@kbd{'})
@tindex vi-goto-mark-line
@kindex '
Move to the beginning of the line containing the specified mark.

@item vi-repeat-find (unbound) (@kbd{;})
@tindex vi-repeat-find
@kindex ;
Repeat the last @code{vi-find} command.

@item vi-rev-repeat-find (unbound) (@kbd{,})
@tindex vi-rev-repeat-find
@kindex ,
Repeat the last @code{vi-find} command in the opposite direction.
@end table

@node History Control, Modifying Text, Movement, Zsh Line Editor
@section History Control

@table @code
@item beginning-of-buffer-or-history (@kbd{ESC-<})
@tindex beginning-of-buffer-or-history
@kindex ESC-<
Move to the beginning of the buffer, or if already there, move to the
first event in the history list.

@item beginning-of-line-hist
@tindex beginning-of-line-hist
Move to the beginning of the line.  If already at the beginning of the
buffer, move to the previous history line.

@item beginning-of-history
@tindex beginning-of-history
Move to the first event in the history list.

@item down-line-or-history (@kbd{^N} @kbd{ESC-[B}) (@kbd{+} @kbd{j})
@tindex down-line-or-history
@kindex CTRL-N
@kindex ESC-[B
@kindex +
@kindex j
Move down a line in the buffer, or if already at the bottom line, move
to the next event in the history list.

@item down-line-or-search
@tindex down-line-or-search
Move down a line in the buffer, or if already at the bottom line,
search forward in the history for a line beginning with the first
word in the buffer.

@item down-history (unbound) (@kbd{^N})
@tindex down-history
@kindex CTRL-N
Move to the next event in the history list.

@item history-beginning-search-backward
@tindex history-beginning-search-backward
Search backward in the history for a line beginning with the current
line up to the cursor.  This leaves the cursor in its original position.

@kindex ESC->
@item end-of-buffer-or-history (@kbd{ESC->})
@tindex end-of-buffer-or-history
Move to the end of the buffer, or if already there, move to the last
event in the history list.

@item end-of-line-hist
@tindex end-of-line-hist
Move to the end of the line.  If already at the end of the buffer, move
to the next history line.

@item end-of-history
@tindex end-of-history
Move to the last event in the history list.

@item vi-fetch-history (unbound) (@kbd{G})
@tindex vi-fetch-history
Fetch the history line specified by the numeric argument.
@kindex G

@item history-incremental-search-backward (@kbd{^R} @kbd{^Xr})
@tindex history-incremental-search-backward
@kindex CTRL-R
@kindex CTRL-X r
Search backward incrementally for a specified string.  The string may
begin with @code{^} to anchor the search to the beginning of the line.
A restricted set of editing functions is available in the mini-buffer.
An interrupt signal, as defined by the stty setting, will stop the
search and go back to the original line.  An undefined key will have the
same effect.  The supported functions are: @code{backward-delete-char},
@code{quoted-insert}, @code{accept-and-hold},
@code{accept-and-infer-next-history}, @code{accept-line} and
@code{accept-line-and-down-history}; @code{magic-space} just inserts a
space.  Any string that is bound to an out-string (via @code{bindkey
-s}) will behave as if out-string were typed directly.  Typing the
binding of @code{history-incremental-search-backward} will get the next
occurrence of the contents of the mini-buffer.  Typing the binding of
@code{history-incremental-search-forward} inverts the sense of the
search.  The direction of the search is indicated in the mini-buffer.
Any multi-character string that is not bound to one of the above
functions will beep and interrupt the search, leaving the last found
line in the buffer.  Any single character that is not bound to one of
the above functions, or @code{self-insert} or @code{self-insert-unmeta},
will have the same effect but the function will be executed.@refill

@item history-incremental-search-forward (@kbd{^Xs})
@tindex history-incremental-search-forward
@kindex CTRL-X s
Search forward incrementally for a specified string.  The string may
begin with @code{^} to anchor the search to the beginning of the line.
The functions available in the mini-buffer are the same as for
@code{history-incremental-search-backward}.@refill

@item history-search-backward (@kbd{ESC-P} @kbd{ESC-p}) (@kbd{K})
@tindex history-search-backward
@kindex ESC-P
@kindex ESC-p
@kindex K
Search backward in the history for a line beginning with the first word
in the buffer.  

@item vi-history-search-backward (unbound) (@kbd{/})
@tindex vi-history-search-backward
@kindex /
Search backward in the history for a specified string.  The string may
begin with @code{^} to anchor the search to the beginning of the line.
A restricted set of editing functions is available in the mini-buffer.
An interrupt signal, as defined by the stty setting, will stop the
search, as will a character bound to @code{vi-cmd-mode}.  The functions
available in the mini-buffer are: @code{accept-line},
@code{backward-delete-char}, @code{vi-backward-delete-char} and
@code{quoted-insert}.  Any string that is bound to an out-string (via
@code{bindkey -s}) will behave as if out-string were typed directly.  Any other
character that is not bound to @code{self-insert} or
@code{self-insert-unmeta} will beep and be ignored.  If the function is
called from vi command mode, the bindings of vi insert mode will be
used.@refill

@item history-search-forward (@kbd{ESC-N} @kbd{ESC-n}) (@kbd{J})
@tindex history-search-forward
@kindex ESC-N
@kindex ESC-n
@kindex J
Search forward in the history for a line beginning with the first word
in the buffer.

@item vi-history-search-forward (unbound) (@kbd{?})
@tindex vi-history-search-forward
@kindex ?
Search forward in the history for a specified string.  The string may
begin with @code{^} to anchor the search to the beginning of the line.
The functions available in the mini-buffer are the same as for
@code{vi-history-search-backward}.@refill

@item infer-next-history (@kbd{^X^N})
@tindex infer-next-history
@kindex CTRL-X CTRL-N
Search in the history for a line matching the current one and fetch the
event following it.

@item insert-last-word (@kbd{ESC-_} @kbd{ESC-.})
@tindex insert-last-word
@kindex ESC-_
@kindex ESC-.
Insert the last word from the previous history event at the cursor
position.

@item vi-repeat-search (unbound) (@kbd{n})
@tindex vi-repeat-search
@kindex n
Repeat the last vi history search.

@item vi-rev-repeat-search (unbound) (@kbd{N})
@tindex vi-rev-repeat-search
@kindex N
Repeat the last vi history search, but in reverse.

@item toggle-literal-history (@kbd{ESC-R} @kbd{ESC-r})
@tindex toggle-literal-history
@pindex HIST_LIT, use of
@kindex ESC-R
@kindex ESC-r
Toggle between literal and lexical history.  The default is lexical
history unless the @code{HIST_LIT} option is set.

@item up-line-or-history (@kbd{^P} @kbd{ESC-[A}) (@kbd{-} @kbd{k})
@tindex up-line-or-history
@kindex CTRL-P
@kindex ESC-[A
@kindex -
@kindex k
Move up a line in the buffer, or if already at the top line, move to the
previous event in the history list.

@item up-line-or-search
@tindex up-line-or-search
Move up a line in the buffer, or if already at the top line, search
backward in the history for a line beginning with the first word in the
buffer.

@item up-history (unbound) (@kbd{^P})
@tindex up-history
@kindex CTRL-P
Move to the previous event in the history list.

@item history-beginning-search-forward
@tindex history-beginning-search-forward
Search forward in the history for a line beginning with the current line
up to the cursor.  This leaves the cursor at its original position.
@end table

@node Modifying Text, Arguments, History Control, Zsh Line Editor
@section Modifying Text

@table @code
@item vi-add-eol (unbound) (@kbd{A})
@tindex vi-add-eol
@kindex A
Move to the end of the line and enter insert mode.

@item vi-add-next (unbound) (@kbd{a})
@tindex vi-add-next
@kindex a
Move forward one character and enter insert mode.

@item backward-delete-char (@kbd{^H} @kbd{^?}) (@kbd{^?})
@tindex backward-delete-char
@kindex CTRL-H
@kindex CTRL-?
Delete the character behind the cursor.

@item vi-backward-delete-char (unbound) (@kbd{X})
@tindex vi-backward-delete-char
@kindex X
Delete the character behind the cursor, without changing lines.

@item backward-delete-word
@tindex backward-delete-word
Delete the word behind the cursor.

@item backward-kill-line
@tindex backward-kill-line
Kill from the beginning of the line to the cursor position.

@item backward-kill-word (@kbd{^W} @kbd{ESC-^H} @kbd{ESC-^?})
@tindex backward-kill-word
@kindex CTRL-W
@kindex ESC-CTRL-H
@kindex ESC-CTRL-?
Kill the word behind the cursor.

@item vi-backward-kill-word (unbound) (@kbd{^W})
@tindex vi-backward-kill-word
@kindex CTRL-W
Kill the word behind the cursor.

@item capitalize-word (@kbd{ESC-C} @kbd{ESC-c})
@tindex capitalize-word
@kindex ESC-C
@kindex ESC-c
Capitalize the current word and move past it.

@item vi-change (unbound) (@kbd{c})
@tindex vi-change
@kindex c
Read a movement command from the keyboard, and kill from the cursor
position to the endpoint of the movement.  Then enter insert mode.  If
the command is @code{vi-change}, kill the current line.@refill

@item vi-change-eol (unbound) (@kbd{C})
@tindex vi-change-eol
@kindex C
Kill to the end of the line and enter insert mode.

@item vi-change-whole-line (unbound) (@kbd{S} @kbd{s})
@tindex vi-change-whole-line
@kindex S
@kindex s
Kill the current line and enter insert mode.

@item copy-region-as-kill (@kbd{ESC-W} @kbd{ESC-w})
@tindex copy-region-as-kill
@kindex ESC-W
@kindex ESC-w
Copy the area from the cursor to the mark to the kill buffer.

@item copy-prev-word (@kbd{ESC-^_})
@tindex copy-prev-word
@kindex ESC-CTRL-_
Duplicate the word behind the cursor.

@item vi-delete (unbound) (@kbd{d})
@tindex vi-delete
@kindex d
Read a movement command from the keyboard, and kill from the cursor
position to the endpoint of the movement.  If the command is
@code{vi-delete}, kill the current line.@refill

@item delete-char (unbound) (@kbd{x})
@tindex delete-char
@kindex x
Delete the character under the cursor.

@item vi-delete-char (unbound) (@kbd{x})
@tindex vi-delete-char
Delete the character under the cursor.

@item delete-word (@kbd{ESC-D} @kbd{ESC-d})
@tindex delete-word
@kindex ESC-D
@kindex ESC-d
Delete the current word.

@item down-case-word (@kbd{ESC-L} @kbd{ESC-l})
@tindex down-case-word
@kindex ESC-L
@kindex ESC-l
Convert the current word to all lowercase and move past it.

@item kill-word
@tindex kill-word
Kill the current word.

@item gosmacs-transpose-chars
@tindex gosmacs-transpose-chars
Exchange the two characters behind the cursor.

@item vi-indent (unbound) (@kbd{>})
@tindex vi-indent
@kindex >
Indent a number of lines.

@item vi-insert (unbound) (@kbd{i})
@tindex vi-insert
@kindex i
Enter insert mode.

@item vi-insert-bol (unbound) (@kbd{I})
@tindex vi-insert-bol
@kindex I
Move to the beginning of the line and enter insert mode.

@item vi-join (@kbd{^X^J})
@tindex vi-join
@kindex CTRL-X CTRL-J
Join the current line with the next one.

@item kill-line (@kbd{^K}) (@kbd{D})
@tindex kill-line
@kindex CTRL-K
@kindex D
Kill from the cursor to the end of the line.

@item vi-kill-line
@tindex vi-kill-line
Kill from the cursor to the beginning of the line.

@item kill-region
@tindex kill-region
Kill from the cursor to the mark.

@item kill-buffer (@kbd{^X^K}) (@kbd{^U})
@tindex kill-buffer
@kindex CTRL-X CTRL-K
@kindex CTRL-U
Kill the entire buffer.

@item kill-whole-line (@kbd{^U})
@tindex kill-whole-line
@kindex CTRL-U
Kill the current line.

@item vi-match-bracket (@kbd{^X^B}) (@kbd{%})
@tindex vi-match-bracket
@kindex CTRL-X CTRL-B
@kindex %
Move to the bracket character (one of @code{@{@}}, @code{()}, or
@code{[]}) that matches the one under the cursor.@refill

@item vi-open-line-above (unbound) (@kbd{O})
@tindex vi-open-line-above
@kindex O
Open a line above the cursor and enter insert mode.

@item vi-open-line-below (unbound) (@kbd{o})
@tindex vi-open-line-below
@kindex o
Open a line below the cursor and enter insert mode.

@item vi-oper-swap-case
@tindex vi-oper-swap-case
Read a movement command from the keyboard, and swap the case of all
characters from the cursor position to the endpoint of the movement.  If
the movement command is @code{vi-oper-swap-case}, swap the case of all
characters on the current line.@refill

@item overwrite-mode (@kbd{^X^O})
@tindex overwrite-mode
@kindex CTRL-X CTRL-O
Toggle between overwrite mode and insert mode.

@item vi-put-after (unbound) (@kbd{p})
@tindex vi-put-after
@kindex p
Insert the contents of the kill buffer after the cursor.

@item quoted-insert (@kbd{^V})
@tindex quoted-insert
@kindex CTRL-V
Insert the next character typed into the buffer literally.

@item quote-line (@kbd{ESC-'})
@tindex quote-line
@kindex ESC-'
Quote the current line; that is, put a @code{'} character at the
beginning and the end, and convert all @code{'} characters to
@code{\'}.@refill

@item quote-region (@kbd{ESC-"})
@tindex quote-region
@kindex ESC-"
Quote the region from the cursor to the mark.

@item vi-replace (unbound) (@kbd{R})
@tindex vi-replace
@kindex R
Enter overwrite mode.

@item vi-repeat-change (unbound) (@kbd{.})
@tindex vi-repeat-change
@kindex .
Repeat the last vi mode text modification.

@item vi-replace-chars (unbound) (@kbd{r})
@tindex vi-replace-chars
@kindex r
Replace the character under the cursor with a character read from the
keyboard.

@item self-insert (printable characters)
@tindex self-insert
Put a character in the buffer at the cursor position.

@item self-insert-unmeta (@kbd{ESC-^I} @kbd{ESC-^J} @kbd{ESC-^M})
@tindex self-insert-unmeta
@kindex ESC-CTRL-I
@kindex ESC-CTRL-J
@kindex ESC-CTRL-M
Put a character in the buffer after stripping the meta bit and
converting @code{^M} to @code{^J}.@refill

@item vi-substitute (unbound) (@kbd{s})
@tindex vi-substitute
@kindex s
Substitute the next character(s).

@item vi-swap-case (unbound) (@kbd{~})
@tindex vi-swap-case
@kindex ~
Swap the case of the character under the cursor and move past it.

@item transpose-chars (@kbd{^T})
@tindex transpose-chars
@kindex CTRL-T
Exchange the two characters to the left of the cursor if at end of line,
else exchange the character under the cursor with the character to the
left.

@item transpose-words (@kbd{ESC-T} @kbd{ESC-t})
@tindex transpose-words
@kindex ESC-T
@kindex ESC-t
Exchange the current word with the one before it.

@item vi-unindent (unbound) (@kbd{<})
@tindex vi-unindent
@kindex <
Unindent a number of lines.

@item up-case-word (@kbd{ESC-U} @kbd{ESC-u})
@tindex up-case-word
@kindex ESC-U
@kindex ESC-u
Convert the current word to all caps and move past it.

@item yank (@kbd{^Y}) (@kbd{P})
@tindex yank
@kindex CTRL-Y
@kindex P
Insert the contents of the kill buffer at the cursor position.

@item yank-pop (@kbd{ESC-y})
@tindex yank-pop
@kindex ESC-y
Remove the text just yanked, rotate the kill-ring, and yank the new top.
Only works following @code{yank} or @code{yank-pop}.

@item vi-yank (unbound) (@kbd{y})
@tindex vi-yank
@kindex y
Read a movement command from the keyboard, and copy the region from the
cursor position to the endpoint of the movement into the kill buffer.
If the command is @code{vi-yank}, copy the current line.

@item vi-yank-eol (unbound) (@kbd{Y})
@tindex vi-yank-eol
@kindex Y
Copy the region from the cursor position to the end of the line into the
kill buffer.
@end table

@node Arguments, Completion, Modifying Text, Zsh Line Editor
@section Arguments

@table @code
@item digit-argument (@kbd{ESC-0}@dots{}@kbd{ESC-9}) (0-9)
@tindex digit-argument
@kindex ESC-0
@kindex ESC-9
@kindex 0
@kindex 9
Start a new numeric argument, or add to the current one.

@item neg-argument (@kbd{ESC--})
@tindex neg-argument
@kindex ESC--
Changes the sign of the following argument.

@item universal-argument
@tindex universal-argument
Multiply the argument of the next command by 4.
@end table

@node Completion, Miscellaneous, Arguments, Zsh Line Editor
@section Completion

@table @code
@item accept-and-menu-complete
@tindex accept-and-menu-complete
In a menu completion, insert the current completion into the buffer, and
advance to the next possible completion.

@item complete-word (unbound) (@kbd{\})
@tindex complete-word
@kindex \
Attempt completion on the current word.

@item delete-char-or-list (@kbd{^D})
@tindex delete-char-or-list
@kindex CTRL-D
Delete the character under the cursor.  If the cursor is at the end of
the line, list possible completions for the current word.

@item execute-named-cmd (@kbd{ESC-x})
@tindex execute-named-cmd
@kindex ESC-x
Read the name of a editor command and execute it.  A restricted set of
editing functions is available in the mini-buffer.  An interrupt signal,
as defined by the stty setting, will abort the function.  The allowed
functions are: @code{backward-delete-char},
@code{vi-backward-delete-char}, @code{kill-region} (kills the last
word), @code{backward-kill-word}, @code{vi-backward-kill-word},
@code{kill-whole-line}, @code{vi-kill-line}, @code{backward-kill-line}
and @code{accept-line}.  The @key{SPACE} and @key{TAB} keys, if not
bound to one of these functions, will complete the name and then list
the possibilities if the @code{AUTO_LIST} option is set.@refill

@item execute-last-named-cmd (@kbd{ESC-z})
@tindex execute-last-named-cmd
@kindex ESC-z
Redo the last function executed with @code{execute-named-cmd}.@refill

@item expand-cmd-path
@tindex expand-cmd-path
Expand the current command to its full pathname.

@item expand-or-complete (@key{TAB}) (@key{TAB} @kbd{^X})
@tindex expand-or-complete
@kindex TAB
@kindex CTRL-X
Attempt shell expansion on the current word.  If that fails, attempt
completion.

@item expand-or-complete-prefix
@tindex expand-or-complete-prefix
Attempt shell expansion on the current word up to the cursor.

@item expand-history (@kbd{ESC-SPACE} @kbd{ESC-!})
@tindex expand-history
@kindex ESC-SPACE
@kindex ESC-!
Perform history expansion on the edit buffer.

@item expand-word (@kbd{^X*})
@tindex expand-word
@kindex CTRL-X *
Attempt shell expansion on the current word.

@item list-choices (@kbd{ESC-^D}) (@kbd{^D=})
@tindex list-choices
@kindex ESC-CTRL-D
@kindex CTRL-D
@kindex =
List possible completions for the current word.

@item list-expand (@kbd{^Xg} @kbd{^XG}) (@kbd{^G})
@tindex list-expand
@kindex CTRL-X g
@kindex CTRL-X G
@kindex CTRL-G
List the expansion of the current word.

@item magic-space
@tindex magic-space
Perform history expansion and insert a space into the buffer.  This is
intended to be bound to @key{SPACE}.

@item menu-complete
@tindex menu-complete
@pindex MENU_COMPLETE, use of
Like @code{complete-word}, except that menu completion is used.
@xref{Options}, for the @code{MENU_COMPLETE} option.@refill

@item menu-expand-or-complete
@tindex menu-expand-or-complete
Like @code{expand-or-complete}, except that menu completion is used.

@item reverse-menu-complete
@tindex reverse-menu-complete
@xref{Options}, for the @code{MENU_COMPLETE} option.
@end table

@node Miscellaneous,  , Completion, Zsh Line Editor
@section Miscellaneous

@table @code
@item accept-and-hold (@kbd{ESC-A} @kbd{ESC-a})
@tindex accept-and-hold
@kindex ESC-A
@kindex ESC-a
Push the contents of the buffer on the buffer stack and execute it.

@item accept-and-infer-next-history
@tindex accept-and-infer-next-history
Execute the contents of the buffer.  Then search the history list for a
line matching the current one and push the event following onto the
buffer stack.

@item accept-line (@kbd{^J} @kbd{^M})
@tindex accept-line
@kindex CTRL-J
@kindex CTRL-M
Execute the contents of the buffer.

@item accept-line-and-down-history (@kbd{^O})
@tindex accept-line-and-down-history
@kindex CTRL-O
Execute the current line, and push the next history event on the the
buffer stack.

@item vi-cmd-mode (@kbd{^X^V}) (@kbd{^[})
@tindex vi-cmd-mode
@kindex CTRL-X CTRL-V
@kindex CTRL-[
Enter command mode; that is, use the alternate keymap.  Yes, this is
bound by default in emacs mode.

@item vi-caps-lock-panic (unbound) (@kbd{H} @kbd{K})
@tindex vi-caps-lock-panic
@kindex H
@kindex K
Hang until any lowercase key is pressed.  This is for vi users without
the mental capacity to keep track of their caps lock key (like the
author).

@item clear-screen (@kbd{^L} @kbd{ESC-^L})
@tindex clear-screen
@kindex CTRL-L
@kindex ESC-CTRL-L
Clear the screen and redraw the prompt.

@item exchange-point-and-mark (@kbd{^X^X})
@tindex exchange-point-and-mark
@kindex CTRL-X CTRL-X
Exchange the cursor position with the position of the mark.

@item get-line (@kbd{ESC-G} @kbd{ESC-g})
@tindex get-line
@kindex ESC-G
@kindex ESC-g
Pop the top line off the buffer stack and insert it at the cursor
position.

@item pound-insert (unbound) (@kbd{#})
@tindex pound-insert
@kindex #
@pindex INTERACTIVE_COMMENTS, use of
If there is no @code{#} character at the beginning of the current line,
add one.  If there is one, remove it.  In either case, accept the
current line.  The @code{INTERACTIVE_COMMENTS} option must be set for
this to have any usefulness.@refill

@item push-input
@tindex push-input
Push the entire current multiline construct onto the buffer stack and
return to the top-level (@code{PS1}) prompt.  If the current parser
construct is only a single line, this is exactly like @code{push-line}.
Next time the editor starts up or is popped with @code{get-line}, the
construct will be popped off the top of the buffer stack and loaded into
the editing buffer.@refill

@item push-line (@kbd{^Q} @kbd{ESC-Q} @kbd{ESC-q})
@tindex push-line
@kindex CTRL-Q
@kindex ESC-Q
@kindex ESC-q
Push the current buffer onto the buffer stack and clear the buffer.
Next time the editor starts up, the buffer will be popped off the top of
the buffer stack and loaded into the editing buffer.

@item push-line-or-edit
@tindex push-line-or-edit
At the top-level (@code{PS1}) prompt, equivalent to @code{push-line}.
At a secondary (@code{PS2}) prompt, move the entire current multiline
construct into the editor buffer.  The latter is equivalent to
@code{push-line} followed by @code{get-line}.@refill

@item redisplay (unbound) (@kbd{^R})
@tindex redisplay
@kindex CTRL-R
Redisplays the edit buffer.

@item run-help (@kbd{ESC-H} @kbd{ESC-h})
@tindex run-help
@kindex ESC-H
@kindex ESC-h
Push the buffer onto the buffer stack, and execute the command
@code{run-help @var{cmd}}, where @var{cmd} is the current command.
@code{run-help} is normally aliased to @code{man}.@refill

@item send-break (@kbd{^C})
@tindex send-break
@kindex CTRL-C
Abort the current editor function, e.g.@: @code{execute-named-command}, or
the editor itself, e.g.@: if you are in @code{vared}.  Otherwise abort the
parsing of the current line.@refill

@item vi-set-buffer (unbound) (@kbd{"})
@tindex vi-set-buffer
@kindex "
Specify a buffer to be used in the following command.

@item vi-set-mark (unbound) (@kbd{m})
@tindex vi-set-mark
@kindex m
Set the specified mark at the cursor position.

@item set-mark-command (@kbd{^@@})
@tindex set-mark-command
@kindex CTRL-@@
Set the mark at the cursor position.

@item spell-word (@kbd{ESC-$} @kbd{ESC-S} @kbd{ESC-s})
@tindex spell-word
@kindex ESC-$
@kindex ESC-S
@kindex ESC-s
Attempt spelling correction on the current word.

@item undefined-key
@tindex undefined-key
Beep.

@item undo (@kbd{^_} @kbd{^X^U} @kbd{^Xu} (@kbd{u})
@tindex undo
@kindex CTRL-_
@kindex CTRL-X CTRL-U
@kindex CTRL-X u
@kindex u
Incrementally undo the last text modification.

@item which-command (@kbd{ESC-?})
@tindex which-command
@kindex ESC-?
Push the buffer onto the buffer stack, and execute the command
@code{which-command @var{cmd}}, where @var{cmd} is the current command.
@code{which-command} is normally aliased to @code{whence}.@refill
@end table

@node Parameters, Options, Zsh Line Editor, Top
@chapter Parameters
@cindex parameters

@noindent
A parameter has a name, a value, and a number of attributes.  A name may
be any sequence of alphanumeric characters and @code{_}'s, or the single
characters @code{*}, @code{@@}, @code{#}, @code{?}, @code{-}, @code{$},
or @code{!}.  The value may be either a scalar (a string), an
integer, or an array.  To assign a scalar or integer value to a
parameter, use the @code{typeset} builtin.  To assign an array value,
@findex typeset, use of
use @samp{set -A @var{name} @var{value} @dots{}}.  The value of a
@findex set, use of
parameter may also be assigned by writing:@refill

@code{@var{name}=@var{value} @dots{}}

@noindent
If the integer attribute, @code{-i}, is set for @var{name}, the
@var{value} is subject to arithmetic evaluation.@refill

@menu
* Array Parameters::		
* Positional Parameters::	
* Parameters Set By The Shell::	 
* Parameters Used By The Shell::  
@end menu

@node Array Parameters, Positional Parameters,  , Parameters
@section Array Parameters

@noindent
The value of an array parameter may be assigned by writing:

@var{name}=(@var{value} @dots{}) @dots{}

@noindent
Individual elements of an array may be selected using a subscript.  A
@cindex array elements
subscript of the form @code{[@var{exp}]} selects the single element
@var{exp}, where @var{exp} is an arithmetic expression.  The elements
are numbered beginning with 1.  A subscript of the form @code{[*]} or
@code{[@@]} evaluates to all elements of an array; there is no
difference between the two except when they appear within double quotes.
@code{"$foo[*]"} evaluates to @code{"$foo[1] $foo[2] @dots{}"}, while
@code{"$foo[@@]"} evaluates to @code{"$foo[1]"} @code{"$foo[2]"}, etc.
A subscript of the form @code{[@var{exp1},@var{exp2}]} selects all
elements in the range @var{exp1} to @var{exp2}, inclusive.  If one of
the subscripts evaluates to a negative number, say @code{-@var{n}}, then
the @var{n}'th element from the end of the array is used.  Thus
@code{$foo[-3]} is the third element from the end of the array
@code{foo}, and @code{$foo[1,-1]} is the same as @code{$foo[*]}.@refill

@noindent
Subscripting may also be performed on non-array values, in which case
@cindex substrings
the subscripts specify a substring to be extracted.  For example, if
@code{FOO} is set to @code{foobar}, then @code{echo $FOO[2,5]} prints
@code{ooba}.@refill

@noindent
If a subscript is used on the left side of an assignment the selected
range is replaced by the expression on the right side.

@noindent
If the opening bracket or the comma is directly followed by an opening
parenthesis the string up to the matching closing parenthesis is
considered to be a list of flags.  The possible flags are:

@table @code
@item e
The argument is expanded using full shell expansion first.

@item w
If the parameter subscripted is a scalar, then this flag makes
subscription work on a per-word basis instead of on a per-character
basis.

@item s:@var{string}:
Defines the @var{string} that separates words (for use with the @code{w}
flag).@refill

@item r
The subscript is taken as a pattern, and the result is the first
matching array element, substring, or word (if the parameter is an
array, scalar, or a scalar and the @code{w} flag is given,
respectively).  Note that this is like giving a number;
@code{$foo[(r)??,3]} and @code{$foo[(r)??,(r)f*]} work.@refill

@item R
Like @code{r}, but returns the last match.

@item i
Like @code{r}, but returns the index of the match.  This may not be
combined with a second argument.@refill

@item I
Like @code{i}, but returns the index of the last match.

@item n:@var{expr}:
If combined with @code{r}, @code{R}, @code{i}, or @code{I}, makes them
return the @var{n}'th or @var{n}'th last match (assuming @var{expr}
evaluates to @var{n}).@refill
@end table

@node Positional Parameters, Parameters Set By The Shell, Array Parameters, Parameters
@section Positional Parameters

@noindent
Positional parameters are set by the shell on invocation, by the
@code{set} builtin, or by direct assignment.  The parameter @var{n},
where @var{n} is a number, is the @var{n}'th positional parameter.  The
parameters @code{*}, @code{@@}, and @code{argv} are arrays containing
all the positional parameters; thus @code{argv[@var{n}]}, is equivalent
to simply @var{n}.@refill

@node Parameters Set By The Shell, Parameters Used By The Shell, Positional Parameters, Parameters
@section Parameters Set By The Shell

@noindent
The following parameters are automatically set by the shell:

@table @code
@item !
@vindex !
The process id of the last background command invoked.

@item #
@vindex #
The number of positional parameters in decimal.

@item ARGC
@vindex ARGC
Same as @code{#}.

@item $
@vindex $
The process id of this shell.

@item -
@vindex -
Flags supplied to the shell on invocation or by the @code{set} or
@code{setopt} commands.@refill

@item *
@vindex *
An array containing the positional parameters.

@item argv
@vindex argv
Same as @code{*}.

@item @@
@vindex @@
Same as @code{argv[@@]}.

@item ?
@vindex ?
The exit value returned by the last command.

@item status
@vindex status
Same as @code{?}.

@item _
@vindex _
The last argument of the previous command.  Also, this parameter is set
in the environment of every command executed to the full pathname of the
command.

@item EGID
@vindex EGID
The effective group id of the shell process.

@item EUID
@vindex EUID
The effective user id of the shell process.

@item ERRNO
@vindex ERRNO
The value of @code{errno} as set by the most recently failed system
call.  This value is system dependent and is intended for debugging
purposes.@refill

@item GID
@vindex GID
The group id of the shell process.

@item HOST
@vindex HOST
The current hostname.

@item HOSTTYPE
@vindex HOSTTYPE
A string corresponding to the type of the host the shell is running on.

@item LINENO
@vindex LINENO
The line number of the current line within the current script being
executed.

@item OLDPWD
@vindex OLDPWD
The previous working directory.

@item OPTARG
@vindex OPTARG
The value of the last option argument processed by the @code{getopts}
command.@refill

@item OPTIND
@vindex OPTIND
The index of the last option argument processed by the @code{getopts}
command.@refill

@item PPID
@vindex PPID
The process id of the parent of the shell.

@item PWD
@vindex PWD
The present working directory.

@item RANDOM
@vindex RANDOM
A random integer from 0 to 32767, newly generated each time this
parameter is referenced.  The random number generator can be seeded by
assigning a numeric value to @code{RANDOM}.@refill

@item SECONDS
@vindex SECONDS
The number of seconds since shell invocation.  If this parameter is
assigned a value, then the value returned upon reference will be the
value that was assigned plus the number of seconds since the assignment.

@item SHLVL
@vindex SHLVL
Incremented by one each time a new shell is started.

@item signals
@vindex signals
An array containing the names of the signals.

@item TTY
@vindex TTY
The name of the tty associated with the shell, if any.

@item UID
@vindex UID
The user id of the shell process.

@item USERNAME
@itemx LOGNAME
@vindex LOGNAME
@vindex USERNAME
The username corresponding to the user id of the shell process.

@item VERSION
@vindex VERSION
The version number of this @code{zsh}.
@end table

@node Parameters Used By The Shell,  , Parameters Set By The Shell, Parameters
@section Parameters Used By The Shell

@noindent
The following parameters are used by the shell:

@table @code
@item ARGV
@vindex ARGV0
If exported, its value is used as argv[0] of external commands.  Usually
used in constructs like @samp{ARGV0=emacs nethack}.@refill

@item BAUD
@vindex BAUD
The baud rate of the current connection.  Used by the line editor update
mechanism to compensate for a slow terminal by delaying updates until
necessary.  This may be profitably set to a lower value in some
circumstances, e.g.@: for slow modems dialing into a communications server
which is connected to a host via a fast link; in this case, this
variable would be set by default to the speed of the fast link, and not
the modem.  This parameter should be set to the baud rate of the slowest
part of the link for best performance.  The compensation mechanism can
be turned off by setting the variable to zero.

@item cdpath (CDPATH)
@vindex cdpath
@vindex CDPATH
An array (colon-separated list) of directories specifying the search
path for the @code{cd} command.@refill

@item COLUMNS
@vindex COLUMNS
The number of columns for this terminal session.  Used for printing
select lists and for the line editor.

@item DIRSTACKSIZE
@vindex DIRSTACKSIZE
@pindex AUTO_PUSHD, use of
The maximum size of the directory stack.  If the stack gets larger than
this, it will be truncated automatically.  This is useful with the
@code{AUTO_PUSHD} option.@refill

@item FCEDIT
@vindex FCEDIT
The default editor for the @code{fc} builtin.

@item fignore (FIGNORE)
@vindex fignore
@vindex FIGNORE
An array (colon-separated list) containing the suffixes of files to be
ignored during filename completion.

@item fpath (FPATH)
@vindex fpath
@vindex FPATH
An array (colon-separated list) of directories specifying the search
path for function definitions.  This path is searched when a function
with the @code{-u} attribute is referenced.  If an executable file is
found, then it is read and executed in the current environment.@refill

@item HISTCHARS
@vindex HISTCHARS
Three characters used by the shell's history and lexical analysis
mechanism.  The first character signals the start of a history
substitution (default @code{!}).  The second character signals the start
of a quick history substitution (default @code{^}).  The third character
is the comment character (default @code{#}).@refill

@item HISTFILE
@vindex HISTFILE
The file to save the history in when an interactive shell exits.  If
unset, the history is not saved.

@item HISTSIZE
@vindex HISTSIZE
The maximum size of the history list.

@item HOME
@vindex HOME
The default argument for the @code{cd} command.

@item IFS
@vindex IFS
Internal field separators, normally space, tab, and newline, that are
used to separate words which result from command or parameter
substitution and words read by the @code{read} builtin.@refill

@item KEYTIMEOUT
@vindex KEYTIMEOUT
The time the shell waits, in hundredths of seconds, for another key to
be pressed when reading bound multi-character sequences.

@item LINES
@vindex LINES
The number of lines for this terminal session.  Used for printing select
lists and for the line editor.

@item LISTMAX
@vindex LISTMAX
In the line editor, the number of filenames to list without asking
first.  If set to zero, the shell asks only if the listing would scroll
off the screen.

@item LITHISTSIZE
@vindex LITHISTSIZE
The maximum size of the literal history list (before history expansion).

@item LOGCHECK
@vindex LOGCHECK
The interval in seconds between checks for login/logout activity using
the @code{watch} parameter.@refill

@item MAIL
@vindex MAIL
If this parameter is set and @code{mailpath} is not set, the shell looks
for mail in the specified file.  By default it is set to the user's
system mailbox.@refill

@item MAILCHECK
@vindex MAILCHECK
The interval in seconds between checks for new mail.

@item mailpath (MAILPATH)
@vindex mailpath
@vindex MAILPATH
An array (colon-separated list) of filenames to check for new mail.
Each filename can be followed by a @code{?} and a message that will be
printed.  The sequence @code{$_} in the message will be replaced by the
name of the mail file.  The default message is @samp{You have new
mail}.  If an element is a directory instead of a file the shell will
recursively check every file in every subdirectory of the
element.@refill

@item manpath (MANPATH)
@vindex manpath
@vindex MANPATH
An array (colon-separated list) whose value is not used by the shell.
The @code{manpath} array can be useful, however, since setting it also
sets @code{MANPATH}, and vice versa.@refill

@item NULLCMD
@vindex NULLCMD
@cindex null command, setting
@cindex csh, null command style
@cindex ksh, null command style
The command name to assume if a redirection is specified with no
command.  Defaults to @code{cat}.  For sh/ksh-like behavior, change this
to @code{:}.  For csh-like behavior, unset this parameter; the shell will
print an error message if null commands are entered.@refill

@item path (PATH)
@vindex path
@vindex PATH
An array (colon-separated list) of directories to search for commands.
When this parameter is set, each directory is scanned and all files
found are put in a hash table.

@item POSTEDIT
@vindex POSTEDIT
This string is output whenever the line editor exits.  It usually
contains termcap strings to reset the terminal.

@item PROMPT
@vindex PROMPT
The primary prompt string, printed before a command is read; the default
is @samp{%m%# }.  If the escape sequence takes an optional integer, it
should appear between the @code{%} and the next character of the
sequence.  The following escape sequences are recognized:@refill

@table @code
@item %d
@itemx %/
Present working directory (@code{$PWD}).

@item %~
@code{$PWD}.  If it has a named directory as its prefix, that part is
replaced by a @code{~} followed by the name of the directory.  If it
starts with @code{$HOME}, that part is replaced by a @code{~}.@refill

@item %c
@itemx %.
@itemx %C
Trailing component of @code{$PWD}.  An integer may follow the @code{%}
to get more than one component.  Unless @code{%C} is used, tilde
expansion is performed first.@refill

@item !
@itemx %h
@itemx %!
Current history event number

@item %M
The full machine hostname.

@item %m
The hostname up to the first @samp{.}.  An integer may follow the @code{%} to
specify how many components of the hostname are desired.@refill

@item %S (%s)
Start (stop) standout mode.

@item %U (%u)
Start (stop) underline mode.

@item %B (%b)
Start (stop) boldface mode.

@item %t
@itemx %@@
Current time of day, in 12-hour, am/pm format.

@item %T
Current time of day, in 24-hour format.

@item %*
Current time of day in 24-hour format, with seconds.

@item %n
@code{$USERNAME}.

@item %w
The date in day-dd format.

@item %W
The date in mm/dd/yy format.

@item %D
The date in yy-mm-dd format.

@item %D@{@var{string}@}
@var{string} is formatted using the @code{strftime} function.  See
@code{strftime(3)} for more details, if your system has it.@refill

@item %l
The line (tty) the user is logged in on.

@item %?
The return code of the last command executed just before the
prompt.@refill 

@item %_
The status of the parser, i.e. the shell constructs (like @code{if} and
@code{for}) that have been started on the command line.  If given an
integer number, that many strings will be printed.@refill

@item %E
Clears to end of screen.  Useful with @code{ALWAYS_LAST_PROMPT}
set.@refill

@item %#
A @code{#} if the shell is running as root, a @code{%} if not.
Equivalent to @code{%(#.#.%%)}@refill

@item %v
The value of the first element of the @code{psvar} array parameter.
Following the @code{%} with an integer gives that element of the
array.@refill

@item %@{@dots{}%@}
Include a string as a literal escape sequence.  The string within the
braces should not change the cursor position.@refill

@item %(x.@var{true-text}.@var{false-text})
Specifies a ternary expression.  The character following the @code{x} is
arbitrary; the same character is used to separate the text for the true
result from that for the false result.  Both the separator and the right
parenthesis may be escaped with a backslash.  @var{true-text} and
@var{false-text} may both contain arbitrarily-nested escape sequences,
including further ternary expressions.  The left parenthesis may be
preceded or followed by a positive integer @var{n}, which defaults to
zero.  The text character @code{x} may be any of the following:@refill

@table @code
@item c
@itemx .
@itemx ~
True if the current path, with prefix replacement, has at least @var{n}
elements.@refill
@item /
@itemx C
True if the current absolute path has at least @var{n} elements.
@item t
True if the time in minutes is equal to @var{n}.
@item T
True if the time in hours is equal to @var{n}.
@item d
True if the day of the month is equal to @var{n}.
@item D
True if the month is equal to @var{n} (January = 0).
@item w
True if the day of the week is equal to @var{n} (Sunday = 0).
@item ?
True if the exit status of the last command was @var{n}.
@item # 
True if the effective uid of the current process is @var{n}.
@item g
True if the effective gid of the current process is @var{n}.
@item L
True if the @code{SHLVL} parameter is at least @var{n}.
@item S
True if the @code{SECONDS} parameter is at least @var{n}.
@item v
True if the array @code{psvar} has at least @var{n} elements.
@item _
True if at least @var{n} shell constructs were started.
@end table
@end table

@item PROMPT2
@vindex PROMPT2
The secondary prompt, printed when the shell needs more information to
complete a command.  Recognizes the same escape sequences as
@code{PROMPT}.  The default is @samp{> }.@refill

@item PROMPT3
@vindex PROMPT3
Selection prompt used within a @code{select} loop.  Recognizes the same
escape sequences as @code{PROMPT}.  The default is @samp{?# }.@refill

@item PROMPT4
@vindex PROMPT4
The execution trace prompt.  Default is @samp{+ }.

@item PS1
@itemx PS2
@itemx PS3
@itemx PS4
@vindex PS1
@vindex PS2
@vindex PS3
@vindex PS4
Same as @code{PROMPT}, @code{PROMPT2}, @code{PROMPT3}, and @code{PROMPT4},
respectively.@refill

@item psvar (PSVAR)
@vindex psvar
@vindex PSVAR
An array (colon-separated list) whose first nine values can be used in
@code{PROMPT} strings.  Setting @code{psvar} also sets @code{PSVAR}, and
vice versa.@refill

@item prompt
@vindex prompt
Same as @code{PROMPT}.

@item READNULLCMD
@vindex READNULLCMD
The command name to assume if a single input redirection is specified
with no command.  Defaults to @code{more}.@refill

@item REPORTTIME
@vindex REPORTTIME
If nonzero, commands whose combined user and system execution times
(measured in seconds) are greater than this value have timing statistics
printed for them.@refill

@item RPROMPT
@itemx RPS1
@vindex RPROMPT
@vindex RPS1
This prompt is displayed on the right-hand side of the screen when the
primary prompt is being displayed on the left.  This does not work if
the @code{SINGLE_LINE_ZLE} option is set.  Recognizes the same escape
sequences as @code{PROMPT}.@refill

@item SAVEHIST
@vindex SAVEHIST
The maximum number of history events to save in the history file.

@item SPROMPT
@vindex SPROMPT
The prompt used for spelling correction.  The sequence @code{%R} expands
to the string which presumably needs spelling correction, and @code{%r}
expands to the proposed correction.  All other @code{PROMPT} escapes are
also allowed.@refill

@item STTY
@vindex STTY
If this parameter is set in a command's environment, the shell runs the
@code{stty} command with the value of this parameter as arguments in
order to set up the terminal before executing the command.  The modes
apply only to the command, and are reset when it finishes or is
suspended.  If the command is suspended and continued later with the
@code{fg} or @code{wait} builtins it will see the modes specified by
STTY, as if it were not suspended.  This (intentionally) does not apply
if the command is continued via @code{kill -CONT}.  @code{STTY} is
ignored if the command is run in the background, or if it is in the
environment of the shell but not explicitly assigned to in the input
line.  This avoids running @code{stty} at every external command by
accidentally exporting it.  Also note that @code{STTY} should not be
used for window size specifications; these will not be local to the
command.@refill
  
@item TIMEFMT
@vindex TIMEFMT
The format of process time reports with the @code{time} keyword.  The
default is @samp{%E real  %U user  %S system  %P %J}.  Recognizes the
following escape sequences:@refill

@table @code
@item %U
CPU seconds spent in user mode.
@item %S
CPU seconds spent in kernel mode.
@item %E
Elapsed time in seconds.
@item %P
The CPU percentage, computed as (%U+%S)/%E.
@item %W
Number of times the process was swapped.
@item %X
The average amount of (shared) text space used in Kbytes.
@item %D
The average amount of (unshared) data/stack space used in Kbytes.
@item %K
The total space used (%X+%D) in Kbytes.
@item %M
The maximum memory the process had in use at any time in Kbytes.
@item %F
The number of major page faults (page needed to be brought from
disk).@refill
@item %R
The number of minor page faults.
@item %I
The number of input operations.
@item %O
The number of output operations.
@item %r
The number of socket messages received.
@item %s
The number of socket messages sent.
@item %k
The number of signals received.
@item %w
Number of voluntary context switches (waits).
@item %c
Number of involuntary context switches.
@item %J
The name of this job.
@end table

@item TMOUT
@vindex TMOUT
If this parameter is nonzero, the shell will terminate if a command is
not entered within the specified number of seconds after issuing a
prompt.

@item TMPPREFIX
@vindex TMPPREFIX
A pathname prefix which the shell will use for all temporary files.
Note that this should include an initial part for the file name as well
as any directory names.  The default is /tmp/zsh.

@item watch (WATCH)
@vindex watch
@vindex WATCH
An array (colon-separated list) of login/logout events to report.  If it
contains the single word @samp{all}, then all login/logout events are
reported.  If it contains the single word @samp{notme}, then all
login/logout events are reported except for those originating from
@code{$USERNAME}.  An entry in this list may consist of a username, an
@code{@@} followed by a remote hostname, and a @code{%} followed by a
line (tty).  Any or all of these components may be present in an entry;
if a login/logout event matches all of them, it is reported.@refill

@item WATCHFMT
@vindex WATCHFMT
The format of login/logout reports if the @code{watch} parameter is set.
Default is @samp{%n has %a %l from %m}.  Recognizes the following escape
sequences:@refill

@table @code
@item %n
The name of the user that logged in/out.

@item %a
The observed action, i.e. @samp{logged on} or @samp{logged off}.

@item %l
The line (tty) the user is logged in on.

@item %M
The full hostname of the remote host.

@item %m
The hostname up to the first @samp{.}.  If only the IP address is
available or the utmp field contains the name of an X-windows display,
the whole name is printed.@refill

@noindent
NOTE: The @code{%m} and @code{%M} escapes will work only if there is a
host name field in the @code{utmp} on your machine.  Otherwise they are
treated as ordinary strings.@refill

@item %S (%s)
Start (stop) standout mode.

@item %U (%u)
Start (stop) underline mode.

@item %B (%b)
Start (stop) boldface mode.

@item %t
@itemx %@@
The time, in 12-hour, am/pm format.

@item %T
The time, in 24-hour format.

@item %w
The date in day-dd format.

@item %W
The date in mm/dd/yy format.

@item %D
The date in yy-mm-dd format.

@item %(x:@var{true-text}:@var{false-text})
Specifies a ternary expression.  The character following the @code{x} is
arbitrary; the same character is used to separate the text for the true
result from that for the false result.  Both the separator and the right
parenthesis may be escaped with a backslash.  Ternary expressions may be
nested.@refill

@noindent
The test character @code{x} may be any one of @code{l}, @code{n},
@code{m}, or @code{M}, which indicate a true result if the corresponding
escape sequence would return a non-empty value; or it may be @code{a},
which indicates a true result if the watched user has logged in, or
false if he has logged out.  Other characters evaluate to neither true
nor false; the entire expression is omitted in this case.@refill

@noindent
If the result is true, then the @var{true-text} is formatted according
to the result above and printed, and the @var{false-text} is skipped.
If false, the @var{true-text} is skipped, and the @var{false-text} is
formatted and printed.  Either or both of the branches may be empty, but
both separators must always be present.@refill
@end table

@item WORDCHARS
@vindex WORDCHARS
A list of nonalphanumeric characters considered part of a word by the
line editor.

@item ZDOTDIR
@vindex ZDOTDIR
The directory to search for shell startup files (@file{.zshrc}, etc), if
not @code{$HOME}.@refill
@end table

@node Options, Shell Builtin Commands, Parameters, Top
@chapter Options
@cindex options

@noindent
The following options may be set upon invocation of the shell, or with
the @code{set} or @code{setopt} builtins.  The names are
case-insensitive and underscores are ignored, that is, @samp{allexport}
is equivalent to @samp{A_lleXP_ort}.@refill

@table @code
@item ALL_EXPORT (-a)
@cindex export, automatic
@pindex ALL_EXPORT
All parameters subsequently defined are automatically exported.

@item ALWAYS_LAST_PROMPT
@cindex history, appending to file
@pindex ALWAYS_LAST_PROMPT
If unset, key functions that list completions try to return to the last
prompt if given a numeric argument.  If set, these functions try to
return to the last prompt if given no numeric argument.@refill

@item ALWAYS_TO_END
@pindex ALWAYS_TO_END
If a completion with the cursor in the word was started and it results
in only one match, the cursor is placed at the end of the word.

@item APPEND_HISTORY
@pindex APPEND_HISTORY
If this is set, zsh sessions will append their history list to the
history file, rather than overwrite it.  Thus, multiple parallel zsh
sessions will all have their history lists added to the history file, in
the order they are killed.  @xref{Shell Builtin Commands}, for the
@code{fc} command.@refill

@item AUTO_CD (-J)
@cindex cd, automatic
@pindex AUTO_CD
If a command is not in the hash table, and there exists an executable
directory by that name, perform the @code{cd} command to that directory.

@item AUTO_LIST (-9)
@cindex completion, listing choices
@pindex AUTO_LIST
Automatically list choices on an ambiguous completion.

@item AUTO_MENU
@cindex completion, menu, on TAB
@pindex AUTO_MENU
Automatically use menu completion after the second consecutive request
for completion, for example by pressing the @key{TAB} key repeatedly.
This option is overriden by @code{MENU_COMPLETE}.@refill

@item AUTO_NAME_DIRS
@cindex directories, named
@pindex AUTO_NAME_DIRS
Any parameter that is set to the absolute name of a directory
immediately becomes a name for that directory in the usual form
@code{~param}.  If this option is not set, the parameter must be used in
that form for it to become a name (a command-line completion is
sufficient for this).@refill

@item AUTO_PARAM_KEYS
@pindex AUTO_PARAM_KEYS
If a parameter name was completed and the next character typed is one of
those that have to come directly after the name (like @code{@}},
@code{:}, etc.), they are placed there automatically.@refill

@item AUTO_PUSHD (-N)
@cindex cd, behaving like pushd
@cindex pushd, making cd behave like
@pindex AUTO_PUSHD
Make @code{cd} act like @code{pushd}.

@item AUTO_REMOVE_SLASH
@cindex slash, removing trailing
@pindex AUTO_REMOVE_SLASH
When the last character resulting from a completion is a slash and the next
character typed is a word delimiter, remove the slash.@refill

@item AUTO_RESUME (-W)
@cindex jobs, resuming automatically
@cindex resuming jobs automatically
@pindex AUTO_RESUME
Treat single word simple commands without redirection as candidates for
resumption of an existing job.

@item BGNICE (-6)
@cindex jobs, background priority
@cindex background jobs, priority of
@pindex BGNICE
Run all background jobs at a lower priority.  This option is set by
default.

@item BRACE_CCL
@cindex brace expansion, extending
@cindex expansion, brace, extended
@pindex BRACE_CCL
Allow brace expansions of the form @code{@{a-zA-Z@}}, etc.

@item CDABLE_VARS (-T)
@cindex cd, to parameter
@pindex CDABLE_VARS
If the argument to a @code{cd} command (or an implied cd with the
@code{AUTO_CD} option set) is not a directory, and does not begin with a
slash, try to expand the expression as if it were preceded by a
@code{~} (@pxref{Filename Expansion}).@refill 

@item CHASE_LINKS (-w)
@cindex links, symbolic
@cindex symbolic links
@pindex CHASE_LINKS
Resolve symbolic links to their true values.

@item COMPLETE_ALIASES
@cindex aliases, completion of
@pindex COMPLETE_ALIASES
If set, aliases on the command line are not internally substituted
before completion is attempted.

@item COMPLETE_IN_WORD
@pindex COMPLETE_IN_WORD
If unset, the cursor is moved to the end of the word if completion is
started.  Otherwise it stays where it is and completion is done from
both ends.

@item CORRECT (-0)
@cindex correction, spelling
@cindex spelling correction
@pindex CORRECT
Try to correct the spelling of commands.

@item CORRECT_ALL (-O)
@pindex CORRECT_ALL
Try to correct the spelling of all arguments in a line.

@item CSH_JUNKIE_HISTORY
@cindex csh, history style
@pindex CSH_JUNKIE_HISTORY
A history reference without an event specifier will always refer to the
previous command.

@item CSH_JUNKIE_LOOPS
@cindex csh, loop style
@cindex loop style, csh
@pindex CSH_JUNKIE_LOOPS
Allow loop bodies to take the form @samp{@var{list}; end} instead of
@samp{do @var{list}; done}.@refill

@item CSH_JUNKIE_PAREN
@pindex CSH_JUNKIE_PAREN
Allow @code{for}, @code{if} and @code{while} loops where the argument
list is given in parentheses.  Otherwise, the parentheses will be
treated as specifying a subshell.@refill

@item CSH_JUNKIE_QUOTES
@cindex csh, quoting style
@cindex quoting style, csh
@pindex CSH_JUNKIE_QUOTES
Complain if a quoted expression runs off the end of a line; prevent
quoted expressions from containing unescaped newlines.

@item GLOB_SUBST
@pindex GLOB_SUBST
Treat any characters resulting from parameter substitution as being
eligible for file expansion and filename generation, and any characters
resulting from command substitution as being eligible for filename
generation.@refill

@item CSH_NULL_GLOB
@cindex csh, null globbing style
@cindex null globbing, csh style
@cindex globbing, null, csh style
@pindex CSH_NULL_GLOB
If a pattern for filename generation has no matches, delete the pattern
from the argument list; do not report an error unless all the patterns
in a command have no matches.  Overrides @code{NULL_GLOB}.@refill

@item ERR_EXIT (-e)
@cindex exit status, trapping
@pindex ERR_EXIT
If a command has a non-zero exit status, execute the @code{ZERR} trap, if
set, and exit.@refill

@item EXTENDED_GLOB
@cindex globbing, extended
@pindex EXTENDED_GLOB
Treat the @code{#} and @code{^} characters as part of patterns for
filename generation, etc.  An initial unquoted @code{~} always produces
named directory expansion (@pxref{Filename Expansion}).@refill

@item EXTENDED_HISTORY
@cindex history, timestamping
@pindex EXTENDED_HISTORY
Save beginning and ending timestamps to the history file.  The format of
these timestamps is @code{:@var{<beginning time>}:@var{<ending
time>}:@var{<command>}}.@refill

@item GLOB_COMPLETE
@pindex GLOB_COMPLETE
When the current word has a glob pattern, do not insert all the words
resulting from the expansion but cycle through them like
@code{MENU_COMPLETE}.  If no matches are found, a @code{*} is added to
the end of the word, or inserted at the cursor if
@code{COMPLETE_IN_WORD} is set, and completion is attempted again.
Using patterns works not only for files but for all completions, such as
options, user names, etc.@refill

@item GLOB_DOTS (-4)
@cindex globbing, of . files
@pindex GLOB_DOTS
Do not require a leading @code{.} in a filename to be matched
explicitly.@refill

@item HASH_CMDS
@cindex hashing, of commands
@cindex command hashing
@pindex HASH_CMDS
Place the location of each command in the hash table the first time it
is executed.  If this option is unset, no path hashing will be done at
all.@refill

@item HASH_DIRS
@cindex hashing, of directories
@cindex directories, hashing
@pindex HASH_DIRS
Whenever a command is executed, hash the directory containing it, as
well as all directories that occur earlier in the path.  Has no effect
if @code{HASH_CMDS} is unset.@refill

@item HASH_LIST_ALL
@pindex HASH_LIST_ALL
Whenever a command completion is attempted, make sure the entire command
path is hashed first.  This makes the first completion slower.

@item HIST_IGNORE_DUPS (-h)
@cindex history, ignoring duplicates
@pindex HIST_IGNORE_DUPS
Do not enter command lines into the history list if they are duplicates
of the previous event.

@item HIST_IGNORE_SPACE (-g)
@cindex history, ignoring spaces
@pindex HIST_IGNORE_SPACE
Do not enter command lines into the history list if they begin with a
blank.

@item HIST_LIT (-j)
@cindex history, storing as literal
@pindex HIST_LIT
Use literal (unparsed) versions of the history lines in the editor.

@item HIST_NO_STORE
@pindex HIST_NO_STORE
Remove the @code{history} (@code{fc -l}) command from the history
when invoked.@refill

@item HIST_VERIFY
@cindex history, verifying substitution
@pindex HIST_VERIFY
Whenever the user enters a line with history substitution, don't execute
the line directly; instead, perform history substitution and reload the
line into the editing buffer.

@item IGNORE_BRACES (-I)
@cindex brace expansion, disabling
@cindex expansion, brace, disabling
@cindex disabling brace expansion
@pindex IGNORE_BRACES
Do not perform brace expansion.

@item IGNORE_EOF (-7)
@cindex EOF, ignoring
@pindex IGNORE_EOF
Do not exit on end-of-file.  Require the use of @code{exit} or
@code{logout} instead.@refill

@item INTERACTIVE (-i)
@pindex INTERACTIVE
This is an interactive shell.

@item INTERACTIVE_COMMENTS (-k)
@cindex comments, in interactive shells
@pindex INTERACTIVE_COMMENTS
Allow comments even in interactive shells.

@item KSH_OPTION_PRINT
@cindex ksh, option printing style
@cindex option printing, ksh style
@pindex KSH_OPTION_PRINT
Alters the way options settings are printed.

@item LIST_AMBIGUOUS
@cindex completions, ambiguous
@cindex ambiguous completions
@pindex LIST_AMBIGUOUS
If this option is set completions are shown only if the completions
don't have an unambiguous prefix or suffix that could be inserted in the
command line.

@item LIST_TYPES (-X)
@cindex files, marking type of
@cindex marking file types
@pindex LIST_TYPES
When listing files that are possible completions, show the type of each
file with a trailing identifying mark.

@item LOGIN (-l)
@pindex LOGIN
This is a login shell.

@item LONG_LIST_JOBS (-R)
@cindex jobs, list format
@cindex list format, of jobs
@pindex LONG_LIST_JOBS
List jobs in the long format by default.

@item MAGIC_EQUAL_SUBST
@pindex MAGIC_EQUAL_SUBST
All unquoted arguments of the form
@code{@var{identifier}=@var{expression}} have file expansion performed
on @var{expression} as if it were a parameter assignment, although the
argument is not otherwise treated specially.@refill

@item MAIL_WARNING (-U)
@cindex mail, warning of arrival
@pindex MAIL_WARNING
Print a warning message if a mail file has been accessed since the shell
last checked.

@item MARK_DIRS (-8)
@cindex directories, marking
@cindex marking directories
@pindex MARK_DIRS
Append a trailing @code{/} to all directory names resulting from filename
generation (globbing).@refill

@item MENU_COMPLETE (-Y)
@cindex completion, menu
@pindex MENU_COMPLETE
On an ambiguous completion, instead of listing possibilities or beeping,
insert the first match immediately.  Then when completion is requested
again, remove the first match and insert the second match, etc.  When
there are no more matches, go back to the first one again.
@code{reverse-menu-complete} may be used to loop through the list in the
other direction.  This option overrides @code{AUTO_MENU}.@refill

@item MONITOR (-m)
@cindex job control, allowing
@pindex MONITOR
Allow job control.  Set by default in interactive shells.

@item NO_BAD_PATTERN (-2)
@cindex globbing, malformed pattern
@pindex NO_BAD_PATTERN
If a pattern for filename generation is badly formed, leave it unchanged
in the argument list instead of printing an error.

@item NO_BANG_HIST (-K)
@cindex history, disabling substitution
@cindex disabling history substitution
@pindex NO_BANG_HIST
Do not perform textual history substitution.  Do not treat the @code{!}
character specially.@refill

@item NO_BEEP (-B)
@cindex beep, disabling
@cindex disabling the beep
@pindex NO_BEEP
Do not beep.

@item NO_CLOBBER (-1)
@cindex file clobbering, preventing
@cindex clobbering, of files
@pindex NO_CLOBBER
Prevents @code{>} redirection from truncating existing files.  @code{>!}
may be used to truncate a file instead.  Also prevents @code{>>} from
creating files.  @code{>>!} may be used instead.@refill

@item NO_EQUALS
@cindex filename substitution, =
@pindex NO_EQUALS
Don't perform @code{=} filename substitution.

@item NO_EXEC (-n)
@cindex command execution, preventing
@pindex NO_EXEC
Read commands and check them for syntax errors, but do not execute them.

@item NO_FLOW_CONTROL
@cindex flow control
@pindex NO_FLOW_CONTROL
Disable output flow control via start/stop characters (usually assigned
to @kbd{^S}/@kbd{^Q}) in the shell's editor.@refill

@item NO_GLOB (-F)
@cindex globbing, disabling
@cindex disabling globbing
@pindex NO_GLOB
Disable filename generation.

@item NO_HIST_BEEP
@cindex history, beeping
@cindex beep, history
@pindex NO_HIST_BEEP
Don't beep when an attempt is made to access a history entry which isn't
there.

@item NO_HUP
@cindex jobs, nohup
@pindex NO_HUP
Don't send the @code{HUP} signal to running jobs when the shell exits.

@item NO_LIST_BEEP
@cindex completion, beep on ambiguous
@cindex beep, ambiguous completion
@pindex NO_LIST_BEEP
Don't beep on an ambiguous completion.

@item NO_NOMATCH (-3)
@cindex globbing, no matches
@pindex NO_NOMATCH
If a pattern for filename generation has no matches, leave it unchanged
in the argument list instead of printing an error.  This also applies
to file expansion of an initial @code{~} or @code{=}.@refill

@item NO_PROMPT_CR (-V)
@cindex prompt, without CR
@pindex NO_PROMPT_CR
Don't print a carriage return just before printing a prompt in the line
editor.

@item NO_RCS (-f)
@cindex startup files, sourcing
@pindex NO_RCS
Source only the @file{/etc/zshenv} file.
Do not source the @file{.zshenv}, @file{/etc/zprofile}, @file{.zprofile},
@file{/etc/zshrc}, @file{.zshrc}, @file{/etc/zlogin}, @file{.zlogin}, or 
@file{.zlogout} files.@refill

@item NO_SHORT_LOOPS
@pindex NO_SHORT_LOOPS
Disallow the short forms of @code{for}, @code{select}, @code{if}, and
@code{function} constructs.@refill

@item NOTIFY (-5)
@cindex background jobs, notification
@cindex notification of background jobs
@pindex NOTIFY
Report the status of background jobs immediately, rather than waiting
until just before printing a prompt.

@item NO_UNSET (-u)
@cindex parameters, error on substituting unset
@cindex unset parameters, error on substituting
@pindex NO_UNSET
Treat unset parameters as an error when substituting.

@item NULL_GLOB (-G)
@cindex globbing, no matches
@pindex NULL_GLOB
If a pattern for filename generation has no matches, delete the pattern
from the argument list instead of reporting an error.  Overrides
@code{NO_NOMATCH}.@refill

@item NUMERIC_GLOBSORT
@cindex sorting, numerically
@pindex NUMERIC_GLOBSORT
If numeric filenames are matched by a filename generation pattern, sort
the filenames numerically rather than lexicographically.

@item OVERSTRIKE
@cindex editor, overstrike mode
@cindex overstrike mode, of editor
@pindex OVERSTRIKE
Start up the line editor in overstrike mode.

@item PATH_DIRS (-Q)
@cindex path search, extended
@pindex PATH_DIRS
Perform a path search even on command names with slashes in them.
Thus if
@display
@samp{/usr/local/bin}
@end display
is in the user's path, and he types @samp{X11/xinit}, the command
@display
@samp{/usr/local/bin/X11/xinit}
@end display
will be executed (assuming it exists).
This applies to the @code{.} builtin as well as to command execution.
Commands explicitly beginning with
@samp{./} or @samp{../} are not subject to path search.@refill

@item PRINT_EXIT_VALUE (-C)
@cindex exit status, printing
@pindex PRINT_EXIT_VALUE
Print the exit value of programs with non-zero exit status.

@item PROMPT_SUBST
@pindex PROMPT_SUBST
Expressions like @code{$@{@dots{}@}}, @code{$(@dots{})}, and @code{$[@dots{}]}
in prompts will be expanded.@refill

@item PUSHD_IGNORE_DUPS
@cindex directory stack, ignoring dups
@pindex PUSHD_IGNORE_DUPS
Don't push multiple copies of the same directory onto the directory
stack.

@item PUSHD_MINUS
@cindex popd, controlling syntax
@pindex PUSHD_MINUS
@xref{Shell Builtin Commands}, for the @code{popd} command.

@item PUSHD_SILENT (-E)
@cindex directory stack, silencing
@pindex PUSHD_SILENT
Do not print the directory stack after @code{pushd} or @code{popd}.

@item PUSHD_TO_HOME (-D)
@cindex pushd, to home
@pindex PUSHD_TO_HOME
Have @code{pushd} with no arguments act like @code{pushd $HOME}.

@item RC_EXPAND_PARAM (-P)
@pindex RC_EXPAND_PARAM
@xref{Parameter Expansion}.

@item RC_QUOTES
@cindex rc, quoting style
@cindex quoting style, rc
@pindex RC_QUOTES
@ifinfo
Allow the character sequence @code{@'@'} to signify a single quote within
@end ifinfo
@iftex
Allow the character sequence @code{''} to signify a single quote within
@end iftex
singly quoted strings.@refill

@item REC_EXACT (-S)
@cindex completion, exact matches
@pindex REC_EXACT
In completion, recognize exact matches even if they are ambiguous.

@item RM_STAR_SILENT (-H)
@cindex rm *, querying before
@cindex querying before rm *
@pindex RM_STAR_SILENT
Do not query the user before executing @code{rm *} or @code{rm path/*}.

@item SHIN_STDIN (-s)
@pindex SHIN_STDIN
Read commands from the standard input.

@item SH_WORD_SPLIT (-y)
@cindex sh, word splitting style
@cindex word splitting, sh style
@pindex SH_WORD_SPLIT
@xref{Parameter Expansion}.

@pindex SINGLE_LINE_ZLE
@cindex editor, single line mode
@item SINGLE_LINE_ZLE (-M)
Use single-line command line editing instead of multi-line.

@item SUN_KEYBOARD_HACK (-L)
@cindex sun keyboard, annoying
@cindex annoying keyboard, sun
@pindex SUN_KEYBOARD_HACK
If a line ends with a backquote, and there are an odd number of
backquotes on the line, ignore the trailing backquote.  This is useful
on some keyboards where the return key is too small, and the backquote
key lies annoyingly close to it.

@item VERBOSE (-v)
@cindex tracing, of input lines
@pindex VERBOSE
Print shell input lines as they are read.

@item XTRACE (-x)
@cindex tracing, of commands
@pindex XTRACE
Print commands and their arguments as they are executed.

@item ZLE (-Z)
@cindex editor, disabling
@cindex disabling the editor
@pindex ZLE
Use the zsh line editor.
@end table

@node Shell Builtin Commands, Invocation, Options, Top
@chapter Shell Builtin Commands
@cindex builtin commands

@table @code
@item . @var{file} [ @var{arg} @dots{} ]
@findex .
Read and execute commands from @var{file} in the current shell
environment.  If @var{file} does not contain a slash, or if
@code{PATH_DIRS} is set, the shell looks in the components of
@code{path} to find the directory containing @var{file}.  Files in the
current directory are not read unless @samp{.} appears somewhere in
@code{path}.  If any arguments @var{arg} are given, they become the
positional parameters; the old positional parameters are restored when
the @var{file} is done executing.  The exit status is the exit status of
the last command executed.@refill

@item : [ @var{arg} @dots{} ]
@cindex parameters, expanding
@cindex expanding parameters
This command only expands parameters.  A zero exit code is returned.

@item alias [ -grm ] [ @var{name}[=@var{value}] ] @dots{}
@cindex alias
@findex alias
With no arguments, print the list of aliases in the form
@code{@var{name}=@var{value}} on the standard output.  For each
@var{name} with a corresponding @var{value}, define an alias with that
value.  A trailing space in @var{value} causes the next word to be
checked for alias substitution.  If the @code{-g} flag is given, define
a global alias; global aliases are expanded even if they do not occur in
command position.  For each @var{name} with no @var{value}, print the
value of @var{name}, if any.  If only the @code{-g} or the @code{-r}
flag is given only global or regular aliases are listed.  If the
@code{-m} flag is given the arguments are taken as patterns (they should
be quoted to preserve them from being interpreted as glob patterns) and
the aliases matching these patterns are printed.  The exit status is
nonzero if a @var{name} (with no @var{value}) is given for which no
alias has been defined.@refill

@item autoload [ @var{name} @dots{} ]
@cindex functions, autoloading
@cindex autoloading functions
@findex autoload
For each of the @var{name}s (which are names of functions), create a
function marked undefined.  The @code{fpath} variable will be searched
to find the actual function definition when the function is first
referenced.@refill

@item bg [ @var{job} @dots{} ]
@itemx @var{job} @dots{} &
@findex bg
Put each specified @var{job} in the background, or the current job if
none is specified.@refill

@item bindkey -mevd
@itemx bindkey -r @var{in-string} @dots{}
@itemx bindkey [ -a ] @var{in-string} [ @var{command} ] @dots{}
@itemx bindkey -s [ -a ] @var{in-string} @var{out-string} @dots{}
@cindex rebinding the keys
@cindex keys, rebinding
@findex bindkey
The @code{-e} and @code{-v} options put the keymaps in emacs mode and vi
mode respectively; they cannot be used simultaneously.  The @code{-d}
option resets all bindings to the compiled-in settings.  If not used
with options @code{-e} or @code{-v}, the maps will be left in emacs
mode, or in vi mode if the @code{VISUAL} or @code{EDITOR} variables
contain the string @samp{vi}.  Metafied characters are bound to
self-insert by default.  The @code{-m} option loads the compiled-in
bindings of these characters for the mode determined by the previous
options, or the current mode if used alone.  Any previous binding done
by the user will be preserved.  If the @code{-r} option is given, remove
any binding for each @var{in-string}.  If the @code{-s} option is not
specified, bind each @var{in-string} to a specified @var{command}.  If
no @var{command} is specified, print the binding of @var{in-string} if
it is bound, or return a nonzero exit code if it is not bound.  If the
@code{-s} option is specified, bind each @var{in-string} to each
specified @var{out-string}.  When @var{in-string} is typed,
@var{out-string} will be pushed back and treated as input to the line
editor.  The process is recursive, but to avoid infinite loops the shell
will report an error if more than 20 consecutive replacements happen.
If the @code{-a} option is specified, bind the @var{in-string}s in the
alternative keymap instead of the standard one.  The alternative keymap
is used in vi command mode.@refill

@noindent
It's possible for an @var{in-string} to be bound to something and also
be the beginning of a longer bound string.  In this case the shell will
wait a certain time to see if more characters are typed, otherwise it
will execute the shorter binding.  This timeout is defined by the
@code{KEYTIMEOUT} parameter; the default is 0.4 seconds.  No timeout is
done if the prefix string is not bound.@refill

@noindent
For either @var{in-string} or @var{out-string}, control characters may
be specified in the form @code{^X}, and the backslash may be used to
introduce one of the following escape sequences:@refill

@table @code
@item \a
Bell character
@item \n
Linefeed (newline)
@item \b
Backspace
@item \t
Horizontal tab
@item \v
Vertical tab
@item \f
Form feed
@item \r
Carriage return
@item \e
@itemx \E
Escape
@item \@var{nnn}
Character code in octal
@item \x@var{nn}
Character code in hexadecimal
@item \M-@var{xxx}
Character or escape sequence with meta bit set.  The @code{-} after the
@code{M} is optional.@refill
@item \C-X
Control character.  The @code{-} after the @code{M} is optional.
@end table

In all other cases, @code{\} escapes the following character.  Delete is
written as @code{^?}.  Note that @code{\M^?} and @code{^\M?} are not the
same.@refill

@noindent
Multi-character @var{in-strings} cannot contain the null character
(@code{^@@} or @code{^ }).  If they appear in a bindkey command, they
will be silently translated to @code{\M-^@@}.  This restriction does not
apply to @var{out-strings}, single-character @var{in-strings} and the
first character of a multi-char @var{in-string}.@refill

@item break [ @var{n} ]
@cindex loops, exitting
@cindex exitting loops
@findex break
Exit from an enclosing @code{for}, @code{while}, @code{until},
@code{select}, or @code{repeat} loop.  If @var{n} is specified, then
break @var{n} levels instead of just one.@refill

@item builtin @var{name} [ @var{args} ] @dots{}
@findex builtin
Executes the builtin @var{name}, with the given @var{args}.

@item bye
@findex bye
Same as @code{exit}.

@item cd [ @var{arg} ]
@itemx cd @var{old} @var{new}
@itemx cd [+-]n
@cindex directories, changing
@findex cd
Change the current directory.  In the first form, change the current
directory to @var{arg}, or to the value of @code{HOME} if @var{arg} is
not specified.  If @var{arg} is @code{-}, change to the value of
@code{OLDPWD}, the previous directory.  If a directory named @var{arg}
is not found in the current directory and @var{arg} does not begin with
a slash, search each component of the shell parameter @code{cdpath}.  If
the option @code{CDABLEVARS} is set, and a parameter named @var{arg}
exists whose value begins with a slash, treat its value as the
directory.@refill

@noindent
The second form of @code{cd} substitutes the string @var{new} for the
string @var{old} in the name of the current directory, and tries to
change to this new directory.@refill

@noindent
The third form of @code{cd} is equivalent to @code{popd}.

@item chdir
@findex chdir
Same as @code{cd}.

@item compctl [ -cfqovbCDAIFpEjBaRGuderzNOZn ] [ -k @var{name} ] [ -X @var{explanation} ]
@itemx [ -K @var{function} ] [ -P @var{prefix} ] [ -S @var{suffix} ] [ -g @var{globstring} ]
@itemx [ -s @var{substring} ] [ -H @var{num pattern} ] [ -l @var{cmd} ] [ @var{arg} @dots{} ]
@itemx compctl @var{flags} + @var{flags} + @dots{}
@itemx compctl @var{flags} -x @var{pattern} @var{flags} - @dots{} -- @var{arg} @dots{}
@cindex completion, controlling
@findex compctl
Control the editor's completion behavior when one of @var{arg} is the
current command.  (Note that aliases are expanded before this is
determined, unless the @code{COMPLETE_ALIASES} option is set.)  With the
@code{-D} flag, control default completion
behavior for commands not assigned any special behavior; with
@code{-C}, control completion when there is no current command.  The
remaining options specify the type of command arguments to look for
during completion.  If completion is attempted for a command with a
pathname containing slashes and no completion is found the search is
retried with the last pathname component.@refill

@table @code
@item -c
Expect command names.

@item -f
Expect filenames and filesystem paths.

@item -o
Expect option names.

@item -v
Expect variable names.

@item -b
Expect key binding names.

@item -A
Expect array names.

@item -I
Expect integer variable names.

@item -F
Expect function names.

@item -p
Expect parameter names.

@item -E
Expect environment variable names.

@item -j
Expect job names (the first word of the job leader's command line, useful
with the @code{kill} builtin).@refill

@item -r
Expect names of running jobs.

@item -z
Expect names of suspended jobs.

@item -B
Expect names of builtin commands.

@item -a
Expect alias names.

@item -R
Expect names of regular aliases.

@item -G
Expect names of global aliases.

@item -u
Expect user names.

@item -d
Expect names of disabled commands.

@item -e
Expect names of executable (and enabled) commands.

@item -N
Expect names of scalar parameters.

@item -n
Expect named directories.

@item -O
Expect names of readonly variables.

@item -Z
Expect names of shell special parameters.

@item -q
If given together with a suffix (see the @code{-S} flag below) it makes
this suffix be removed if the next character typed is a blank or does
not insert anything (this is the same rule as used for the
@code{AUTO_REMOVE_SLASH} option).@refill

@item -k @var{name}
Expect names taken from the elements of @code{$name} (which should be an
array).  Alternatively,
the argument @var{name} itself may be a set of space- or comma-separated
values in parentheses, in which any delimiter may be escaped with a
backslash.  Example: @samp{compctl -k "(cputime filesize datasize
stacksize coredumpsize resident descriptors)" limit}.@refill

@item -K @var{function}
Call the given function to get the completions.  The function gets two
arguments: the prefix and the suffix of the word on which completion is
tried.  The function should set the variable @code{reply} to an array
containing the completions (one completion per element); note that
@code{reply} should not be made local.  From such a function the command
line can be accessed with the @code{-c} and @code{-l} flags to the
@code{read} builtin.  Example: @samp{function whoson @{ reply=(`users`);
@}; compctl -K whoson talk} completes only logged-on users after
@samp{talk}.  Note that @code{whoson} must return an array so that just
@samp{reply=`users`} is incorrect.@refill

@item -X @var{explanation}
Print the explanation string before the list of completions.  A @code{%n}
in this string is replaced by the number of matches.@refill

@item -P @var{prefix}
The @var{prefix} is inserted just before the completed string; any
initial part already typed will be completed and the whole @var{prefix}
ignored for completion purposes.  Example: @samp{compctl -j -P "%"
kill}.@refill

@item -S @var{suffix}
After a unique completion is found the @var{suffix} is inserted after
the completed string.@refill

@item -g @var{globstring}
The @var{globstring} is expanded using filename globbing; it should be
quoted to protect it from immediate expansion.  The resulting filenames
are taken as the possible completions.  Use @code{*(/)} instead of
@code{*/} for directories.  The @code{fignore} special parameter is not
used.  More than one of these pattern may be given separated by blanks.
Note that brace expansion is @emph{not} part of globbing.@refill

@item -s @var{substring}
The @var{substring} is split into words and these words are than
expanded using all shell expansion mechanisms.  The resulting words are
taken as possible completions.  The @code{fignore} special parameter is
@emph{not} used.  Note that @code{-g} is faster for filenames.@refill

@item -H @var{num pattern}
The possible completions are taken from the last @var{num} history
lines.  Only words matching @var{pattern} are taken.  If @var{num} is
zero or negative the whole history is searched and if @var{pattern} is
the empty string (or @code{*}, of course) all words are taken.@refill

@item -l @var{cmd}
This option cannot be combined with any other option.  If it is given it
restricts the range of command line words that are considered to be
arguments.  By default this range contains all arguments without the
command string.  If combined with extended completion (see below) and one of
@code{p[@dots{}]}, @code{r[@dots{}]}, or @code{R[@dots{}]} the range is
restricted to the arguments between the ones that are specified in the
brackets.  After the range of arguments is determined completion is done
in it as if they were arguments to the @var{cmd} given with this option.
If this string is empty the first word in the range is taken as the
command name for which to complete.  In this case, if the cursor is in
@ifinfo
the first word, command names are completed.  Example: @samp{compctl -x
'r[-exec,;]' -l @'@' -- find} completes the arguments between @code{-exec}
@end ifinfo
@iftex
the first word, command names are completed.  Example: @samp{compctl -x
'r[-exec,;]' -l '' -- find} completes the arguments between @code{-exec}
@end iftex
and the following @code{;} (or the end of the command line if there is
no such string) as if they were specifying a command on their
own.@refill

@item -U
Use the whole list of possible completions, whether or not they actually
match the word on the command line.  The word typed so far will be
deleted.  This is most useful with a function (@code{-K} option), which
can examine the word via the @code{read} builtin's @code{-c} and
@code{-l} flags and use its own criterion to decide what matches.@refill
@end table

@noindent
The second form specifies alternative options.  First completion is
tried with the options before the first @code{+}.  If this produces no
matches completion is tried with the flags after the @code{+} and so on.
If there are no flags after the last @code{+} this means that default
completion is tried if no matches were found.@refill

@noindent
The third form specifies extended completion for the commands given as
@var{arg}.  Each @var{pattern} is examined in turn; when a match is
found, the corresponding @var{flags}, as described above for the
ordinary case, are used to generate possible completions.  If no
@var{pattern} matches, the @var{flags} given before the @code{-x} are
used.  Note that each pattern should be supplied as a single argument
and should be quoted to prevent expansion of metacharacters by the
shell.  A @var{pattern} is built of sub-patterns separated by commas; it
matches if at least one of these sub-patterns matches (they are or'ed).
These sub-patterns are in turn composed of other sub-patterns separated
by white space which match if all of the sub-patterns match (they are
and'ed).  An element of the sub-patterns is of the form
@code{c[@dots{}][@dots{}]}, where the pairs of brackets may be repeated as
often as necessary, and matches if any of the sets of brackets match (an
or).  These elements may be any of the following:@refill

@table @code
@item s[@var{string}] @dots{}
The pattern matches if the current word on the command line starts with
one of the strings given in brackets.  The @var{string} is not removed
and is not part of the completion.@refill

@item S[@var{string}] @dots{}
Like @code{s[@var{string}]} but the @var{string} is part of the
completion.@refill

@item p[@var{from},@var{to}] @dots{}
The pattern matches if the number of the current word is between one of
the @var{from} and @var{to} pairs.  The comma and @var{to} are optional;
@var{to} defaults to the same value as @var{from}.  The numbers may be
negative: @var{-n} refers to the @var{n}'th last word on the
line.@refill

@item c[@var{offset},@var{string}] @dots{}
The pattern matches if one of the @var{string}s matches the word offset
by @var{offset} from the current word position.@refill

@item C[@var{offset},@var{pattern}] @dots{}
Like @code{c} but uses pattern matching instead.

@item w[@var{index},@var{string}] @dots{}
The pattern matches if the word in position @var{index} is equal to the
corresponding @var{string}.  Note that the word count is made after
alias expansion.@refill

@item W[@var{index},@var{pattern}] @dots{}
Like @code{w} but uses pattern matching instead.

@item n[@var{index},@var{string}] @dots{}
Matches if the current word contains @var{string}.  Anything up to the
@var{index}'th ocurrence of this string will not be considered part of
the completion, but the rest will.@refill

@item N[@var{index},@var{string}] @dots{}
Like @code{n[@var{index},@var{string}]} but the string will be taken as
a character class (anything up to the @var{index}'th ocurrence of any of
the characters in @var{string} will not be considered part of the
completion).@refill

@item m[@var{min},@var{max}] @dots{}
Matches if the total number of words lies between @var{min} and
@var{max} (inclusive).@refill

@item r[@var{str1},@var{str2}]@dots{}
Matches if the cursor is after a word with prefix @var{str1}.  If there
is also a word with prefix @var{str2} on the command line it matches
only if the cursor is before this word.@refill

@item R[@var{str1},@var{str2}]@dots{}
Like @code{r} but uses pattern matching instead.
@end table

@noindent
Example:
@noindent
@samp{compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' -
's[-f],c[-1,-f]' -f -- mail}
@noindent
Complete users by default.  After a @code{-f} with an optional space,
complete file names; if a @code{+} follows the @code{-f}, whether or not
there is a space in between, complete with the non-directory part of
files in the directory @samp{~/Mail}.@refill

@item continue [ @var{num} ]
@cindex loops, continuing
@cindex continuing loops
@findex continue
Resume the next iteration of the enclosing @code{for}, @code{while},
@code{until}, @code{select}, or @code{repeat} loop.  If @var{n} is
specified, break out of @var{n}-1 loops and resume at the @var{n}'th
enclosing loop.@refill

@item declare [ @var{arg} @dots{} ]
@findex declare
Same as @code{typeset}.

@item dirs [ -v ] [ @var{arg} @dots{} ]
@cindex directory stack, printing
@findex dirs
With no arguments, print the contents of the directory stack.  If the
@code{-v} option is given, number the directories in the stack when
printing.  Directories are added to this stack with the @code{pushd}
command, and removed with the @code{cd} or @code{popd} commands.  If
arguments are specified, load them onto the directory stack, replacing
anything that was there, and push the current directory onto the
stack.@refill

@item disable [ -m ] @var{arg} @dots{}
@cindex disabling commands
@cindex commands, disabling
@findex disable
Disable the builtin @var{arg} temporarily.  This allows you to use an
external command with the same name as a shell builtin.  Without
arguments all disabled builtins are printed; with the @code{-m} flag the
arguments are taken as patterns (which should be quoted to preserve them
from being taken as glob patterns) and all builtins matching these
patterns are disabled.  Actually the same as @code{unhash}.  Builtins
can be enabled with the @code{enable} command.@refill

@item disown @var{job} @dots{}
@findex disown
Remove the specified jobs from the job table; the shell will no longer
report their status, and will not complain if you try to exit an
interactive shell with them running or stopped.

@item echo [ -n ] [ @var{arg} @dots{} ]
@findex echo
Write each @var{arg} on the standard output, with a space separating
each one.  If the @code{-n} flag is not present, print a newline at the
end.  @code{echo} recognizes the following escape sequences:@refill

@table @code
@item \a
Bell
@item \b
Backspace
@item \c
Don't print an ending newline
@item \e
Escape
@item \f
Form feed
@item \n
Newline
@item \r
Carriage return
@item \t
Horizontal tab
@item \v
Vertical tab
@item \\
Backslash
@item \0NNN
Character code in octal, with a maximum of three digits after the zero.
A non-octal digit terminates the number.
@item \xNN
Character code in hexadecimal, with a maximum of two digits after the
@code{x}.  A non-hexadecimal digit terminates the number.@refill
@end table

@item echotc @var{cap} [ @var{arg} @dots{} ]
@cindex termcap string, printing
@findex echotc
Output the termcap string corresponding to the capability @var{cap},
with optional arguments.@refill

@item enable [ -m ] @var{arg} @dots{}
@findex enable
Enable the specified builtin commands, presumably disabled earlier with
@code{disable}.  Without arguments the enabled builtins are printed;
with the @code{-m} flag the arguments are taken as patterns (and hence
should be quoted), and all builtins matching these patterns are
enabled.@refill

@item eval [ @var{arg} @dots{} ]
@cindex evaluating arguments as commands
@findex eval
Read the arguments as input to the shell and execute the resulting
command(s) in the current shell process.

@item exit [ @var{n} ]
@pindex IGNORE_EOF, use of
@findex exit
Exit the shell with the exit code specified by @var{n}; if none is
specified, use the exit code from the last command executed.  An
@code{EOF} condition will also cause the shell to exit, unless the
@code{IGNORE_EOF} option is set.@refill

@item export [ @var{name}[=@var{value}] @dots{} ]
@findex export
The specified @var{name}s are marked for automatic export to the
environment of subsequently executed commands.@refill

@item false
@findex false
Do nothing and return an exit code of 1.

@item fc [ -e @var{ename} ] [ -nlrdDfEm ] [ @var{old}=@var{new} @dots{} ] [ @var{first} [ @var{last} ]]
@itemx fc -ARWI [ @var{filename} ]
@cindex history, editting
@cindex editting the history
@findex fc
Select a range of commands from @var{first} to @var{last} from the
history list.  The arguments @var{first} and @var{last} may be specified
as a number or as a string.  A negative number is used as an offset to
the current history event number.  A string specifies the most recent
event beginning with the given string.  All substitutions
@var{old}=@var{new}, if any, are then performed on the commands.  If the
@code{-l} flag is given, the resulting commands are listed on standard
output.  If the @code{-m} flag is also given the first argument is taken
as a pattern (which should be quoted), and only the history events
matching this pattern will be shown.  Otherwise the editor program
@var{ename} is invoked on a file containing these history events.  If
@var{ename} is not given, the value of the parameter @code{FCEDIT} is
used.  If @var{ename} is @code{-}, no editor is invoked.  When editing
is complete, the edited command(s) is executed.  If @var{first} is not
specified, it will be set to -1 (the most recent event), or to -16 if
the @code{-l} flag is given.  If @var{last} is not specified, it will be
set to @var{first}, or to -1 if the @code{-l} flag is given.  The flag
@code{-r} reverses the order of the commands and the flag @code{-n}
suppresses command numbers when listing.  Also when listing, @code{-d}
prints timestamps for each command, @code{-f} prints full time and date
stamps, and @code{-D} prints elapsed times.  Adding the @code{-E} flag
causes the dates to be printed in the European format
(@var{dd.mm.yyyy}).@refill

@noindent
@code{fc -R} reads the history from the given file, @code{fc -W} writes
@cindex history, file
@cindex file, history
the history out to the given file, and @code{fc -A} appends the history
to the given file.  @code{fc -AI} (@code{-WI}) appends (writes) only
those events that are new since the last incremental append (write) to
the history file.  In any case the file will have no more than
@code{SAVEHIST} entries.@refill

@item fg [ @var{job} @dots{} ]
@itemx @var{job} @dots{}
@findex fg
Bring the specified @var{job}s to the foreground.  If no @var{job} is
specified, use the current job.@refill

@item functions [ +-tum ] [ @var{name} @dots{} ]
@findex functions
Equivalent to @code{typeset -f}.

@item getln @var{name} @dots{}
@cindex line, reading
@cindex reading a line
@findex getln
Read the top value from the buffer stack and put it in the shell
parameter @var{name}.  Equivalent to @code{read -zr}.  The flags
@code{-c}, @code{-l}, @code{-A}, @code{-e}, @code{-E}, and @code{-n} are
also supported.@refill

@item getopts @var{optstring} @var{name} [ @var{arg} @dots{} ]
@cindex options, processing
@findex getopts
Checks @var{arg} for legal options.  If @var{arg} is omitted, use the
positional parameters.  A valid option argument begins with a @code{+}
or a @code{-}.  An argument not beginning with a @code{+} or a @code{-},
or the argument @code{--}, ends the options.  @var{optstring} contains
the letters that @code{getopts} recognizes.  If a letter is followed by
a @code{:}, that option is expected to have an argument.  The options
can be separated from the argument by blanks.@refill

@noindent
Each time it is invoked, @code{getopts} places the option letter it
finds in the shell parameter @var{name}, prepended with a @code{+} when
@var{arg} begins with a @code{+}.  The index of the next @var{arg} is
stored in @code{OPTIND}.  The option argument, if any, is stored in
@vindex OPTIND, use of
@code{OPTARG}.@refill
@vindex OPTARG, use of

@noindent
A leading @code{:} in @var{optstring} causes @code{getopts} to store the
letter of the invalid option in @code{OPTARG}, and to set @var{name} to
@code{?} for an unknown option and to @code{:} when a required option is
missing.  Otherwise, @code{getopts} prints an error message.  The exit
status is nonzero when there are no more options.@refill

@item hash @var{name} @var{path}
@findex hash
Puts @var{name} in the command hash table, associating it with the
pathname @var{path}.  Whenever @var{name} is used as a command argument,
the shell will try to execute the file given by @var{path}.@refill

@item history [ -nrdDfEm ] [ @var{first} [ @var{last} ]]
@findex history
Same as @code{fc -l}.

@item integer [ +-lrtux ] [ @var{name}[=@var{value}] ]
@findex integer
Same as @code{typeset -i}, except that options irrelevant to integers
are not permitted.@refill

@item jobs [ -lprs ] [ @var{job} @dots{} ]
@findex jobs
Lists information about each given job, or all jobs if @var{job} is
omitted.  The @code{-l} flag lists process ids, and the @code{-p} flag
lists process groups.  If the @code{-r} flag is given only running jobs
will be listed; if the @code{-s} flag is given only stopped jobs are
shown.@refill

@item kill [ -@var{sig} ] @var{job} @dots{}
@itemx kill -l
@cindex jobs, killing
@cindex killing jobs
@findex kill
Sends either @code{SIGTERM} or the specified signal to the given jobs or
processes.  Signals are given by number or by names (with the prefix
@code{SIG} removed).  If the signal being sent is not @code{KILL} or
@code{CONT}, then the job will be sent a @code{CONT} signal if it is
stopped.  The argument @var{job} can be the process id of a job not in
the job list.  In the second form, @code{kill -l}, the signal names are
listed.@refill

@item let @var{arg} @dots{}
@findex let
Evaluate each @var{arg} as an arithmetic expression.
@c
@c Why does the next line cause Info-validate to say "invalid reference"?
@c
@xref{Arithmetic Evaluation}, for a description of arithmetic
expressions.  The exit status is 0 if the value of the last expression
is nonzero, and 1 otherwise.@refill

@item limit [ -h ] [ @var{resource} [ @var{limit} ]] @dots{}
@itemx limit -s
@cindex resource limits
@cindex limits, resource
@findex limit
Limit the resource consumption of children of the current shell.  If
@var{limit} is not specified, print the current limit placed on
@var{resource}; otherwise set the limit to the specified value.  If the
@code{-h} flag is given, use hard limits instead of soft limits.  If no
@var{resource} is given, print all limits.  See also @code{ulimit}.
@var{resource} is one of:@refill

@table @code
@item cputime
Maximum CPU seconds per process.
@item filesize
Largest single file allowed.
@item datasize
Maximum data size (including stack) for each process.
@item stacksize
Maximum stack size for each process.
@item coredumpsize
Maximum size of a core dump.
@item resident
@itemx memoryuse
Maximum resident set size.
@item memorylocked
Maximum amount of memory locked in RAM.
@item descriptors
Maximum value for a file descriptor.
@item openfiles
Maximum number of open files.
@item vmemorysize
Maximum amount of virtual memory.
@end table

Which of these resource limits are available depends on the system.
@var{limit} is a number, with an optional scaling factor, as
follows:@refill

@table @code
@item @var{n}h
Hours.
@item @var{n}k
Kilobytes.  This is the default for all but cputime.
@item @var{n}m
Megabytes or minutes.
@item @var{mm}:@var{ss}
Minutes and seconds.
@end table

@item local [ +-LRZilrtu [@var{n}]] [ @var{name}[=@var{value}] ]
@findex local
Same as @code{typeset}, except that the options @code{-x} and @code{-f}
are not permitted.@refill

@item log
@cindex users, watching
@cindex watching users
@vindex watch, use of
@findex log
List all users currently logged in who are affected by the current
setting of the @code{watch} parameter.@refill

@item logout
@findex logout
Exit the shell, if this is a login shell.

@item popd [ +-@var{n} ]
@pindex PUSHD_MINUS, use of
@findex popd
Removes entries from the directory stack.  With no arguments, removes
the top directory from the stack, and performs a @code{cd} to the new
top directory.  With an argument of the form @code{+@var{n}}, remove the
@var{n}'th entry counting from the left of the list shown by the
@code{dirs} command, starting with zero, and change to that directory.
With an argument of the form @code{-@var{n}}, remove the @var{n}'th entry
counting from the right.  If the @code{PUSHD_MINUS} option is set, the
meanings of @code{+} and @code{-} in this context are swapped.@refill

@item print [ -RnrslzpNDPoOic ] [ -u@var{n} ] [ @var{arg} @dots{} ]
@findex print
With no flags or with flag @code{-}, the arguments are printed on the
standard output as described by @code{echo}, with the following
differences: the escape sequence @code{\M-x} metafies the character
@code{x} (sets the highest bit), @code{\C-x} produces a control
character (@code{\C-@@} and @code{\C-?} give the characters NULL and
delete) and @code{\E} is a synonym for @code{\e}.  Finally, if not in an
escape sequence, @code{\} escapes the following character and is not
printed.@refill

@table @code
@item -R
@itemx -r
Ignore the escape conventions of @code{echo}.  The @code{-R} option
will print all subsequent arguments and options.@refill
@item -s
Place the results in the history list instead of on the standard
output.@refill
@item -n
Do not add a newline to the output.
@item -l
Print the arguments separated by newlines instead of spaces.
@item -N
Print the arguments separated and terminated by nulls.
@item -o
Print the arguments sorted in ascending order.
@item -O
Print the arguments sorted in descending order.
@item -i
If given together with @code{-o} or @code{-O}, makes the sort be
case-insensitive.@refill
@item -c
Print the arguments in columns.
@item -u@var{n}
Print the arguments to file descriptor @var{n}.
@item -p
Print the arguments to the input of the coprocess.
@item -z
Push the arguments onto the editing buffer stack, separated by spaces;
no escape sequences are recognized.@refill
@item -D
Treat the arguments as directory names, replacing prefixes with @code{~}
expressions, as appropriate.@refill
@item -P
Recognize the same escape sequences as in the @code{PROMPT}
parameter.@refill
@end table

@item pushd [ @var{arg} ]
@itemx pushd @var{old} @var{new}
@itemx pushd +-@var{n}
@findex pushd
@pindex PUSHD_TO_HOME, use of
@pindex CDABLEVARS, use of
@pindex PUSHD_SILENT, use of
Change the current directory, and push the old current directory onto
the directory stack.  In the first form, change the current directory to
@var{arg}.  If @var{arg} is not specified, change to the second
directory on the stack (that is, exchange the top two entries), or
change to the value of @code{HOME} if the @code{PUSHD_TO_HOME} option is
set or if there is only one entry on the stack.  If @var{arg} is
@code{-}, change to the value of @code{OLDPWD}, the previous directory.
If a directory named @var{arg} is not found in the current directory and
@var{arg} does not contain a slash, search each component of the shell
parameter @code{cdpath}.  If the option @code{CDABLEVARS} is set, and a
parameter named @var{arg} exists whose value begins with a slash, treat
its value as the directory.  If the option @code{PUSHD_SILENT} is not
set, the directory stack will be printed after a @code{pushd} is
performed.@refill

@noindent
The second form of @code{pushd} substitutes the string @var{new} for the
string @var{old} in the name of the current directory, and tries to
change to this new directory.@refill

@noindent
The third form of @code{pushd} is equivalent to @code{popd}.

@item pushln
@findex pushln
Equivalent to @code{print -nZ}.

@item pwd
@findex pwd
Equivalent to @code{print -R $PWD}.

@item r
@findex r
Equivalent to @code{fc -e -}.

@item read [ -rzpqAclneE ] [ -k [@var{num}] ] [ -u@var{n} ] [ @var{name}?@var{prompt} ] [ @var{name} @dots{} ] 
@vindex IFS
@findex read
Read one line and break it into fields using the characters in
@code{IFS} as separators.  In raw mode, @code{-r}, a @code{\} at the end
of a line does not signify line continuation.  With the @code{-q} flag
read only one character and set @var{name} to @samp{y} if this character
was @samp{y} or @samp{Y}, and to @samp{n} otherwise.  With this flag set
the return value is zero only if the character was @samp{y} or @samp{Y}.
If the @code{-k}
flag is given read only one (or @var{num}) characters.  If the @code{-z}
flag is given, read from the editor buffer stack.  The first field is
assigned to the first @var{name}, the second field to the second
@var{name}, etc, with leftover fields assigned to the last @var{name}.
If the @code{-e} or the @code{-E} flag is given, the words read are
printed after the whole line is read.  If the @code{-e} flag is given,
the words are not assigned to the parameters.  If the @code{-A} flag is
given, the first @var{name} is taken as the name of an array and all
words are assigned to it.  If @var{name} is omitted then @code{REPLY} is
used for scalars and @code{reply} for arrays.  The @code{-c} and
@code{-l} flags are allowed only if called inside a function used for
completion (specified with the @code{-K} flag to @code{compctl}).  If
the @code{-c} flag is given, the words of the current command are read.
If the @code{-l} flag is given, the whole line is assigned as a scalar.
Together with the @code{-n} flag these options give the number of the
word the cursor is on and the index of the character the cursor is on
respectively.  If @code{-u@var{n}} is specified, then input is read from
file descriptor @var{n}; if @code{-p} is specified, then input is read
from the coprocess.  If the first argument contains a @code{?}, the remainder
of this word is used as a @var{prompt} on standard error when the shell
is interactive.  The exit status is 0 unless an end-of-file is
encountered.@refill

@item readonly [ @var{name}[=@var{value}]] @dots{}
@cindex parameters, marking readonly
@findex readonly
The given @var{names} are marked readonly; these names cannot be changed
by subsequent assignment.@refill

@item rehash [ -f ]
@findex rehash
Throw out the command hash table and start over.  If the @code{-f}
option is given, rescan the command path immediately, instead of
rebuilding the hash table incrementally.@refill

@item return [ @var{n} ]
@cindex functions, returning from
@findex return
Causes a shell function or @code{.} script to return to the invoking
script with the return status specified by @var{n}.  If @var{n} is
omitted then the return status is that of the last command
executed.@refill

@noindent
If @code{return} was executed from a trap, whether set by the
@code{trap} builtin or by defining a @code{TRAP@var{xxx}} function, the
effect is different for zero and non-zero return status.  With zero
status (or after an implicit return at the end of the trap), the shell
will return to whatever it was previously processing; with a non-zero
status, the shell will behave as interrupted except that the return
status of the trap is retained.  Note that the signal which caused the
trap is passed as the first argument, so the statement @samp{return
$[128+$1]} will return the same status as if the signal had not been
trapped.@refill

@item sched [+]@var{hh}:@var{mm} @var{command} @dots{}
@itemx sched [ -@var{item} ]
@cindex timed execution
@cindex execution, timed
@findex sched
Make an entry in the scheduled list of commands to execute.  The time
may be specified in either absolute or relative time.  With no
arguments, prints the list of scheduled commands.  With the argument
@code{-@var{item}}, removes the given item from the list.@refill

@item set [ +-@var{options} ] [ +-o @var{option name} ] @dots{} [ -A [@var{name}] ] [ @var{arg} ] @dots{} 
@cindex parameters, positional
@cindex parameters, array
@cindex array parameter, declaring
@findex set
Set the options for the shell and/or set the positional parameters, or
declare an array.  @xref{Options}, for the meaning of the flags.  Flags
may be specified by name using the @code{-o} option.  If the @code{-A}
flag is given, @var{name} is set to an array containing the given
@var{arg}s; if no @var{name} is specified, all arrays are printed.
Otherwise the positional parameters are set.  If no arguments are given,
then the names and values of all parameters are printed on the standard
output.  If the only argument is @code{+}, the names of all parameters
are printed.@refill

@item setopt [ -m ] [ +-@var{options} ] [ @var{name} @dots{} ]
@cindex options, setting
@findex setopt
Set the options for the shell.  All options specified either with flags
or by name are set.  If no arguments are supplied, the names of all
options currently set are printed.  In option names, case is
insignificant, and all underscore characters are ignored.  If the
@code{-m} flag is given the arguments are taken as patterns (which
should be quoted to preserve them from being interpreted as glob
patterns), and all options with matching names are set.@refill

@item shift [ @var{n} ] [ @var{name} @dots{} ]
@cindex parameters, positional
@findex shift
The positional parameters from @code{$@var{n}+1} @dots{} are renamed
@code{$1}, where @var{n} is an arithmetic expression that defaults to 1.
If any @var{name}s are given then the arrays with these names are
shifted, instead of the positional parameters.@refill

@item source
@findex source
Same as @samp{.}, except that the current directory is always searched
and is always searched first, before directories in @code{path}.@refill

@item suspend [ -f ]
@cindex shell, suspending
@findex suspend
Suspend the execution of the shell (send it a @code{SIGTSTP}) until it
receives a @code{SIGCONT}.  If the @code{-f} option is not given,
complain if this is a login shell.@refill

@item test @var{arg} @dots{}
@itemx [ @var{arg} @dots{} ]
@findex test
Like the system version of @code{test}.  Added for compatibility; use
conditional expressions instead.@refill

@item times
@cindex shell, timing
@cindex timing the shell
@findex times
Print the accumulated user and system times for the shell and for
processes run from the shell.

@item trap [ @var{arg} ] [ @var{sig} ] @dots{}
@cindex signals, trapping
@cindex trapping signals
@findex trap
@var{arg} is a command to be read and executed when the shell receives
@var{sig}.  Each @var{sig} can be given as a number or as the name of a
signal.  Inside the command, @code{$1} refers to the number of the
signal that caused the trap.
If @var{arg} is @code{-}, then all traps @var{sig} are reset to
their default values.  If @var{arg} is the null string, then this signal
is ignored by the shell and by the commands it invokes.  If @var{sig} is
@code{ZERR} then @var{arg} will be executed after each command with a
nonzero exit status.  If @var{sig} is @code{DEBUG} then @var{arg} will
be executed after each command. If @var{sig} is @code{0} or @code{EXIT}
and the @code{trap} statement is executed inside the body of a function,
then the command @var{arg} is executed after the function completes.  If
@var{sig} is @code{0} or @code{EXIT} and the @code{trap} statement is
not executed inside the body of a function, then the command @var{arg}
is executed when the shell terminates.  The @code{trap} command with no
arguments prints a list of commands associated with each signal.@refill

@item true
@findex true
Do nothing and return an exit code of 0.

@item ttyctl [ -fu ]
@cindex tty, freezing
@findex ttyctl
The @code{-f} option freezes the tty, and @code{-u} unfreezes it.  When
the tty is frozen, no changes made to the tty settings by external
programs will be honored by the shell, except for changes in the size of
the screen; the shell will simply reset the
settings to their previous values as soon as each command exits.  Thus,
@code{stty} and similar programs have no effect when the tty is
frozen.  Without options it reports whether the terminal is frozen or
not.@refill

@item type
@findex type
Same as @code{whence -v}.

@item typeset [ +-LRZfilrtuxm [@var{n}]] [ @var{name}[=@var{value}]] @dots{}
@cindex parameters, setting
@findex typeset
Set attributes and values for shell parameters.  When invoked inside a
function, a new parameter is created which will be unset when the
function completes.  The new parameter will not be exported unless
@code{ALL_EXPORT} is set, in which case the parameter will be exported
provided no parameter of that name already exists.  The following
attributes are valid:@refill

@table @code
@item -L
Left justify and remove leading blanks from @var{value}.  If @var{n} is
nonzero, it defines the width of the field; otherwise it is determined
by the width of the value of the first assignment.  When the parameter
is printed, it is filled on the right with blanks or truncated if
necessary to fit the field.  Leading zeros are removed if the @code{-Z}
flag is also given.@refill

@item -R
Right justify and fill with leading blanks.  If @var{n} is nonzero it
defines the width of the field; otherwise it is determined by the width
of the value of the first assignment.  When the parameter is printed,
the field is left filled with blanks or truncated from the end.@refill

@item -Z
Right justify and fill with leading zeros if the first non-blank
character is a digit and the @code{-L} flag has not been set.  If
@var{n} is nonzero it defines the width of the field; otherwise it is
determined by the width of the value of the first assignment.@refill

@item -f
The names refer to functions rather than parameters.  No assignments can
be made, and the only other valid flags are @code{-t} and @code{-u}.
The flag @code{-t} turns on execution tracing for this function.  The
flag @code{-u} causes this function to be marked for autoloading.  The
@code{fpath} parameter will be searched to find the function definition
when the function is first referenced.@refill

@item -i
Use an internal integer representation.  If @var{n} is nonzero it
defines the output arithmetic base, otherwise it is determined by the
first assignment.@refill

@item -l
Convert to lower case.

@item -r
The given @var{name}s are marked readonly.

@item -t
Tags the named parameters.  Tags have no special meaning to the
shell.@refill

@item -u
Convert to upper case.

@item -x
Mark for automatic export to the environment of subsequently executed
commands.@refill
@end table

@noindent
Using @code{+} rather than @code{-} causes these flags to be turned off.
If no arguments are given but flags are specified, a list of named
parameters which have these flags set is printed.  Using @code{+}
instead of @code{-} keeps their values from being printed.  If no
arguments or options are given, the names and attributes of all
parameters are printed.  If just the @code{-m} flag is given the
arguments are taken as patterns (which should be quoted), and all
parameters or functions (with the @code{-f} flag) with matching names
are printed.@refill

@item ulimit [ -Hacdflmnopstv ] [ @var{limit} ]
@cindex resource limits
@cindex limits, resource
@findex ulimit
Set or display a resource limit.  When setting a limit it will apply to
the children of the shell but not to the shell itself.
The value of limit can be a number in
the unit specified below or the value @samp{unlimited}.  If the @code{-H}
flag is given use hard limits instead of soft limits.  See also
@code{limit}.@refill

@table @code
@item -a
Lists all of the current resource limits.
@item -c
Maximum size of core dumps, in 512-byte blocks.
@item -d
Maximum size of the data segment, in Kbytes.
@item -f
Maximum size of individual files written, in 512-byte blocks.
@item -l
Maximum size of locked-in memory, in Kbytes.
@item -m
Maximum size of physical memory, in Kbytes.
@item -n
Maximum number of file descriptors.
@item -o
Maximum number of open files.
@item -p
Maximum number of processes.
@item -s
Maximum size of stack, in Kbytes.
@item -t
Maximum number of CPU seconds.
@item -v
Maximum size of virtual memory, in Kbytes.
@end table

@item umask [ @var{mask} ]
@cindex umask
@findex umask
The umask is set to @var{mask}.  @var{mask} can be either an octal
number or a symbolic value as described in @code{chmod(1)}.  If
@var{mask} is omitted, the current value is printed.  Note that in the
symbolic form the permissions you specify are those which are to be
allowed (not denied) to the users specified).@refill

@item unalias [ -m ] @var{name} @dots{}
@cindex aliases, removing
@findex unalias
The alias definition, if any, for each @var{name} is removed.  With the
@code{-m} flag, the arguments are taken as patterns (which should be
quoted), and all aliases with matching names are removed.@refill

@item unfunction [ -m ] @var{name} @dots{}
@cindex functions, removing
@findex unfunction
The function definition, if any, for each @var{name} is removed.  With
the @code{-m} flag, the arguments are taken as patterns (which should be
quoted), and all function with matching names are removed.@refill

@item unhash [ -m ] @var{name} @dots{}
@findex unhash
The entry in the command hash table, if any, for each @var{name} is
removed.  With the @code{-m} flag, the arguments are taken as patterns
(which should be quoted), and all entries for commands with matching
names are removed.@refill

@item unlimit [ -h ] @var{resource} @dots{}
@cindex limits, resource
@cindex resource limits
@findex unlimit
The resource limit for each @var{resource} is set to the hard limit.  If
the @code{-h} flag is given and the shell is running as root, the hard
resource limit for each @var{resource} is removed.@refill

@item unset [ -m ] @var{name} @dots{}
@cindex parameters, unsetting
@findex unset
Each named parameter is unset.  With the @code{-m} flag, the arguments
are taken as patterns (which should be quoted), and all parameters with
matching names are unset.@refill

@item unsetopt [ -m ]  [ +-@var{options} ] [ @var{name} @dots{} ]
@cindex options, unsetting
@findex unsetopt
Unset the options for the shell.  All options specified either with
flags or by name are unset.  With the @code{-m} flag, the arguments are
taken as patterns (which should be quoted), and all options with
matching names are unset.@refill

@item vared [ -c ] [ -p @var{prompt}] [ -r @var{rprompt} ] @var{name}
@cindex parameters, editting
@cindex editting parameters
@findex vared
The value of the parameter @var{name} is loaded into the edit buffer,
and the line editor is invoked.  When the editor exits, @var{name} is
set to the string value returned by the editor.  If the @code{-c} flag
is given, the parameter is created if it doesn't already exist.  If the
@code{-p} flag is given, @var{prompt} will be taken as the prompt to
display at the left.  If the @code{-r} flag is given, @var{rprompt} will
be taken as the prompt to display at the right.@refill

@item wait [ @var{job} @dots{} ]
@cindex jobs, waiting for
@cindex waiting for jobs
@findex wait
Wait for the specified jobs or processes.  If @var{job} is not given
then all currently active child processes are waited for.  Each
@var{job} can be either a job specification or the process-id of a job
in the job table.  The exit status from this command is that of the job
waited for.@refill

@item whence [ -acpvm ] @var{name} @dots{}
@findex whence
For each name, indicate how it would be interpreted if used as a command
name.  The @code{-v} flag produces a more verbose report.  The @code{-p}
flag does a path search for @var{name} even if it is a shell function,
alias, or reserved word.  The @code{-c} flag prints the results in a
csh-like format.  The @code{-a} flag does a search for all occurences of
@var{name} throughout the command path.  With the @code{-m} flag, the
arguments are taken as patterns (which should be quoted), and the
information is displayed for each command matching one of these
patterns.@refill

@item which
@findex which
Same as @code{whence -c}.
@end table

@node Invocation, Wrapping Up, Shell Builtin Commands, Top
@chapter Invocation
@cindex invocation

@noindent
@code{zsh [ +-@var{options} ] [ +-o @var{option} ] @dots{}  [ -c @var{string} ] [ @var{arg} @dots{} ]}

@noindent
Commands are first read from @file{/etc/zshenv}.  If the @code{-f} flag
@cindex files, startup
@cindex startup files
is given or if the @code{NO_RCS} option is set within
@file{/etc/zshenv}, all other initialization files are skipped.
Otherwise, commands are read from @file{$ZDOTDIR/.zshenv} (if
@code{ZDOTDIR} is unset, @code{HOME} is used instead).  If the first
character of argument zero passed to the shell is @code{-}, or if the
@code{-l} flag is present, then the shell is assumed to be a login
shell, and commands are read from @file{/etc/zprofile} and then
@file{$ZDOTDIR/.zprofile}.  Then, if the shell is interactive and the
@code{NO_RCS} option is unset, commands are read from @file{/etc/zshrc}
@pindex NO_RCS, use of
and then @file{$ZDOTDIR/.zshrc}.  Finally, if the shell is a login
shell, @file{/etc/zlogin} and @file{$ZDOTDIR/.zlogin} are read.@refill

@noindent
If the @code{-s} flag is not present and an argument is given,
the first argument is taken to be the pathname of a script to execute.
The remaining arguments are assigned to the positional parameters.  The
following flags are interpreted by the shell when invoked:@refill

@table @code
@item -c @var{string}
@cindex flags, shell
@cindex shell flags
Read commands from @var{string}.

@item -s
Read command from the standard input.

@item -i
If this flag is present or the shell input and output are attached to a
terminal, this shell is interactive.
@end table

@node Wrapping Up, Concept Index, Invocation, Top
@chapter Wrapping Up

@section See Also

@noindent
sh(1), csh(1), tcsh(1), itcsh(1), rc(1), bash(1), ash(1), ksh(1),
clam(1), strftime(3).

@section Files
@cindex files used

@noindent
$ZDOTDIR/.zshenv@*
@noindent
$ZDOTDIR/.zprofile@*
@noindent
$ZDOTDIR/.zshrc@*
@noindent
$ZDOTDIR/.zlogin@*
@noindent
$ZDOTDIR/.zlogout@*
@noindent
/tmp/zsh*@*
@noindent
/etc/zshenv@*
@noindent
/etc/zprofile@*
@noindent
/etc/zshrc@*
@noindent
/etc/zlogin

@section Author

@noindent
Paul Falstad (pf@@z-code.com).  Programmable completion was implemented
by Sven Wischnowsky (oberon@@cs.tu-berlin.de) and Peter Stephenson
(pws@@s-a.amtp.liv.ac.uk).@refill

@section Availability
@cindex availability

@noindent
The latest official release of zsh is available via anonymous ftp from
@code{ftp.sterling.com}, in the directory @code{/zsh} and from
@code{carlo.phys.uva.nl}, in the directory @code{/pub/bas/zsh}.@refill

@section Undocumented Features
@cindex undocumented features

@noindent
Known only to the recipients of the zsh mailing list,
@code{zsh-list@@sterling.com}.  If you run into problems, please
send your questions and patches to the mailing list.  To subscribe to
zsh-list, send an email message with the body @samp{subscribe zsh-list}
to @code{Majordomo@@sterling.com}.@refill


@node Concept Index, Variables Index, Wrapping Up, Top
@unnumbered Concept Index

@printindex cp

@node Variables Index, Options Index, Concept Index, Top
@unnumbered Variables Index

@printindex vr

@node Options Index, Functions Index, Variables Index, Top
@unnumbered Options Index

@printindex pg

@node Functions Index, Editor Functions Index, Options Index, Top
@unnumbered Functions Index

@printindex fn

@node Editor Functions Index, Keystroke Index, Functions Index, Top
@unnumbered Editor Functions Index

@printindex tp

@node Keystroke Index,  , Editor Functions Index, Top
@unnumbered Keystroke Index

@printindex ky


@setchapternewpage odd
@contents
@bye

@c v0.1, July 8th 1992.  Added documentation for Rick's
@c (pclink@@qld.tne.oz.au) four new glob qualifiers (a/m/c/L)
@c v0.2, August 11th 1992.  Added documentation for the new PSVAR
@c variable, the f E and I flags for the fc command, and the
@c appendhistory and extendedhistory options.  Also corrected a typo in
@c the description of the ${ := } modifier.  Now current to zsh2.3beta
@c (patch level 28).
@c v0.3, August 21 1992.  Unified to the zsh.1 (patchlevel 30) patches
@c supplied by Hans Albertsson.  This meant rewriting most of the extra
@c text I added in v0.1 and v0.2, in order to match Hans'.  Corrected
@c some more typos ("is has" in several places). 
@c       [ added to the archive sometime around here ]
@c v0.4, November 1 1992.  Added up-line-or-search to complement
@c down-line-or-search.  Moved information about availability and the
@c mailing list to the end of the file, to match zsh.1.  Should now be
@c current to patchlevel 65.
@c v0.5, February 5 1993.  Has been kept mostly up-do-date by denizens
@c of the mailing list.  Final clean-up to conform to the new release
@c of zsh version 2.3 (man page dated 1 February 1993), and to the new
@c Texinfo standards (but should remain compatible with old Texinfo).
Eventually I want to rewrite to use the new features of Texinfo v2.0
and above, but we'll have to wait for the rest of the world to catch
up first.  <sigh>
v0.6, June 20th 1993.  Now matches zsh.1 from zsh2.4 patchlevel 158.
Also fixed a few typographical niceties (blank lines between items,
added some more refills, capitalized item descriptions).  Todo: more
cross-referencing, more indexing of new features, and separate vi
and emacs keystroke indices.
v0.7, September 29th 1993.  Now matches zsh.1 from zsh2.4 patchlevel
162, as supplied with 2.4.264.  Also separated out multiple table
entries, compressed secondary tables, and used the new @kbd construct
where possible.
v0.8, December 30th 1993.  Now matches zsh.1 as supplied with zsh
2.4.291.  Changed occurrences of @code{..} @var{..} into @code{..
@var{..}} to make info version cleaner, removed extraneous @code in
@item lines, escaped occurrences of '', other minor bugfixes.
v0.9. June 20th 1994.  Final (I hope) revision before 2.5 is released.
v1.0. June 20th 1994.  Add latest manpage additions and update zsh
version numbers throughout the document. (by Bas)
