-
simple command
.
file [ arg ... ]
PATH_DIRS
is set, the shell looks in the components of $path
to find the
directory containing file.
Files in the current directory are not read unless `.
' appears
somewhere in $path
.
If any arguments arg are given,
they become the positional parameters; the old positional
parameters are restored when the file is done executing.
The exit status is the exit status of the last command executed.
:
[ arg ... ]
alias
[ -gmrL
] [ name[=
value] ... ]
-g
flag is present,
define a global alias; global aliases are expanded even if they do not
occur in command position.
For each name with no value,
print the value of name, if any. With no arguments, print all
currently defined aliases. If the -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. When printing aliases and the -g
or -r
flags
are present, then restrict the printing to global or regular
aliases, respectively.
If the -L
flag is present, then print each
alias in a manner suitable for putting in a startup script. The exit
status is nonzero if a name (with no value) is given for
which no alias has been defined.
autoload
functions -u
.
bg
[ job ... ]
&
break
[ n ]
for
, while
,
until
, select
or repeat
loop. If n
is specified, then break n levels instead of just one.
builtin
name [ args ... ]
bye
exit
.
cd
[ -sLP
] [ arg ]
cd
[ -sLP
] old new
cd
[ -sLP
] {+
|-
}n
$HOME
if
arg is not specified. If arg is `-
', change to the
value of $OLDPWD
, the previous directory.
If a directory named arg is not found in the current directory
and arg does not begin with a slash,
search each component of the shell parameter cdpath
.
If the option CDABLE_VARS
is set, and a parameter named arg
exists whose value begins with a slash, treat its value as
the directory.
The second form of cd
substitutes the string new
for the string old in the name of the current directory,
and tries to change to this new directory.
The third form of cd
extracts an entry from the directory
stack, and changes to that directory. An argument of the form
`+
n' identifies a stack entry by counting from the left
of the list shown by the dirs
command, starting with zero.
An argument of the form `-
n' counts from the right.
If the PUSHD_MINUS
option is set, the meanings of `+
'
and `-
' in this context are swapped.
If the -s
option is specified, cd
will refuse change the currect
directory if the given pathname contains symlinks. If the -P
option
is given or the CHASE_LINKS
option is set, symbolic links are resolved
to their true values. If the -L
option is given symbolic links are
followed regardless of the state of the CHASE_LINKS
option.
chdir
cd
.
command
simple command
continue
[ n ]
for
, while
, until
, select
or
repeat
loop. If n is specified, break out of
n-1 loops and resume at the nth enclosing loop.
declare
typeset
.
dirs
[ -v
] [ arg ... ]
-v
option is given, number the directories
in the stack when printing.
Directories are added to this stack with the pushd
command,
and removed with the cd
or 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.
disable
[ -afmr
] name ...
-a
option
causes disable
to act on aliases. The -f
option causes
disable
to act on shell functions. The -r
options causes
disable
to act on reserved words. Without arguments all disabled
hash table elements from the corresponding hash table are printed.
With the -m
flag the arguments are taken as patterns (should be
quoted to preserve them from being taken as glob patterns), and all hash
table elements from the corresponding hash table matching these patterns
are disabled. Disabled objects can be enabled with the enable
command.
disown
[ job ... ]
&|
&!
echo
[ -neE
] [ arg ... ]
-n
flag is not present, print a newline at the end.
echo
recognizes the following escape sequences:
\a
\b
\b
\e
\f
\n
\r
\t
\v
\\
\0
NNN
\x
NN
-E
flag, or the BSD_ECHO
option, can be used to disable
these escape sequences. In the latter case, -e
flag can be used to
enable them.
echotc
cap [ arg ... ]
emulate
[ -R
] {zsh
|sh
|ksh
|csh
}
zsh
will be used as a default. If the -R
option is given, all options
are reset to their default value corresponding to the specified emulation
mode.
enable
[ -afmr
] name ...
disable
. The default is to enable builtin commands.
The -a
option causes enable
to act on aliases. The -f
option causes enable
to act on shell functions. The -r
option causes enable
to act on reserved words. Without arguments
all enable hash table elememts from the corresponding hash table are
printed. With the -m
flag the arguments are taken as patterns
(should be quoted) and all hash table elements from the corresponding
hash table matching these patterns are enabled. Enabled objects can be
disabled with the disable
builtin command.
eval
[ arg ... ]
exec
simple command
exit
[ n ]
IGNORE_EOF
option is set.
export
[ name[=
value] ... ]
typeset -x
, except that no parameter will be created
to hide an existing one in an outer scope.
If a parameter specified does not
already exist, it is created in the global scope.
false
[ arg ... ]
fc
[ -e
ename ] [ -nlrdDfEim
] [ old=
new ... ] [ first [ last ] ]
fc
-ARWI
[ filename ]
=
new, if any, are then performed
on the commands.
If the -l
flag is given, the resulting commands are listed on
standard output.
If the -m
flag is also given the first argument is taken as a
pattern (should be quoted) and only the history events matching this
pattern will be shown.
Otherwise the editor program ename is invoked on a file containing
these history events. If ename is not given, the value
of the parameter FCEDIT
is used. If ename is `-
',
no editor is invoked. When editing is complete, the edited
command is executed.
If first is not specified, it will be set to -1 (the most recent
event), or to -16 if the -l
flag is given.
If last is not specified, it will be set to first,
or to -1 if the -l
flag is given.
The flag -r
reverses the order of the commands and the
flag -n
suppresses command numbers when listing.
Also when listing, -d
prints timestamps for each command, and
-f
prints full time-date stamps. Adding the -E
flag
causes the dates to be printed as `dd.
mm.
yyyy',
instead of the default `mm/
dd/
yyyy'.
Adding the -i
flag causes the dates to be printed in ISO8601
`yyyy-
mm-
dd' format.
With the -D
flag, fc
prints elapsed times.
fc -R
reads the history from the given file,
fc -W
writes the history out to the given file,
and fc -A
appends the history out to the given file.
If the -I
option is added, only those
events that are new since last incremental append (write) to
the history file are appended (written).
In any case the file will have no more than $SAVEHIST
entries.
fg
[ job ... ]
functions
[ {+
|-
}tum
] [ name ... ]
typeset -f
.
getln
[ -AclneE
] name ...
name
. Equivalent to
read -zr
.
getopts
optstring name [ arg ... ]
+
' or a `-
'. An argument not beginning with
a `+
' or a `-
', or the argument `--
', ends the options.
optstring contains the letters that getopts
recognizes. If a letter is followed by a `:
', that option
is expected to have an argument. The options can be
separated from the argument by blanks.
Each time it is invoked, getopts
places the option letter it finds
in the shell parameter name, prepended with a `+
' when
arg begins with a `+
'. The index of the next arg
is stored in OPTIND
. The option argument, if any,
is stored in OPTARG
.
A leading `:
' in optstring causes getopts
to store the
letter of the invalid option in OPTARG
, and to set name
to `?
' for an unknown option and to `:
' when a required option
is missing. Otherwise, getopts
prints an error
message. The exit status is nonzero when there are no more options.
hash
[ -dfmrv
] [ name[=
value] ] ...
hash
can be used to directly modify the contents of the command
hash table, and the named directory hash table. Normally one would
modify these tables by modifying one's PATH
(for the command hash table) or by creating appropriate shell parameters
(for the named directory hash table).
The choice of hash table to work on is determined by the -d
option;
without the option the command hash table is used, and with the option the
named directory hash table is used.
Given no arguments, and neither the -r
or -f
options,
the selected hash table will be listed in full.
The -r
option causes the selected hash table to be emptied.
It will be subsequently rebuilt in the normal fashion.
The -f
option causes the selected hash table to be fully
rebuilt immediately. For the command hash table this hashes
all the absolute directories in the PATH
,
and for the named directory hash table this adds all users' home directories.
These two options cannot be used with any arguments.
The -m
option causes the arguments to be taken as patterns
(they should be quoted) and the elements of the hash table
matching those patterns are printed. This is the only way to display
a limited selection of hash table elements.
For each name with a corresponding value, put `name' in
the selected hash table, associating it with the pathname `value'.
In the command hash table, this means that
whenever `name' is used as a command argument, the shell will try
to execute the file given by `value'.
In the named directory hash table, this means
that `value' may be referred to as `~
name'.
For each name with no
corresponding value, attempt to add name to the hash table,
checking what the appropriate value
is in the normal manner for
that hash table. If an appropriate value
can't be found, then
the hash table will be unchanged.
The -v
option causes hash table entries to be listed as they are
added by explicit specification. If has no effect if used with -f
.
history
fc -l
.
integer
[ {+
|-
}lrtux
] [ name[=
value] ... ]
typeset -i
, except that options irrelevant to
integers are not permitted.
jobs
[ -dlprs
] [ job ... ]
jobs -Z
string
-l
flag lists process
IDs, and the -p
flag lists process groups.
If the -r
flag is specified only running jobs will be listed
and if the -s
flag is given only stopped jobs are shown.
If the -d
flag is given, the directory from which the job was
started (which may not be the current directory of the job) will also
be shown.
The -Z
option replaces the shell's argument and environment space with
the given string, truncated if necessary to fit. This will normally be
visible in ps
(man page ps(1)) listings. This feature is typically
used by daemons, to indicate their state.
kill
[ -s
signal_name ] job ...
kill
[ -
sig ] job ...
kill
-l
[ sig ... ]
SIGTERM
or the specified signal to the given
jobs or processes.
Signals are given by number or by names, without the `SIG
' prefix.
If the signal being sent is not `KILL
' or `CONT
', then the job
will be sent a `CONT
' signal if it is stopped.
The argument job can be the process ID of a job
not in the job list.
In the third form, kill -l
, if sig is not
specified the signal names are listed. Otherwise, for each
sig that is a name, the corresponding signal number is
listed. For each sig that is a signal number or a number
representing the exit status of a process which was terminated or
stopped by a signal the name of the signal is printed.
let
arg ...
limit
[ -hs
] [ resource [ limit ] ] ...
-s
flag is given,
the limit applies only the children of the shell. If -s
is
given without other arguments, the resource limits of the current
shell is set to the previously set resource limits of the children.
If limit is not specified, print the current limit placed
on resource, otherwise
set the limit to the specified value. If the -h
flag
is given, use hard limits instead of soft limits.
If no resource is given, print all limits.
resource can be one of:
memorylocked
resident
vmemorysize
descriptors
coredumpsize
stacksize
datasize
filesize
cputime
maxproc
addressspace
cachedthreads
h
k
m
:
]ss
local
[ {+
|-
}LRZilrtu
[n]] [ name[=
value] ] ...
typeset
, except that the options -x
and
-f
are not permitted.
log
watch
parameter.
logout
[ n ]
exit
, except that it only works in a login shell.
noglob
simple command
popd
[ {+
|-
}n ]
cd
to
the new top directory. With no argument, the current top entry is
removed. An argument of the form `+
n' identifies a stack
entry by counting from the left of the list shown by the dirs
command,
starting with zero. An argument of the form -n
counts from the right.
If the PUSHD_MINUS
option is set, the meanings of `+
' and
`-
' in this context are swapped.
print
[ -nrslzpNDPoOicm
] [ -u
n ] [ -R
[ -en
]] [ arg ... ]
-
', the arguments are printed on
the standard output as described by echo
, with the following differences:
the escape sequence `\M-
x' metafies the character
x (sets the highest bit),
`\C-
x' produces a control character (`\C-@
' and `\C-?
' give the
characters NUL and delete), and `\E
' is a synonym for `\e
'.
Finally, if not in an escape
sequence, `\
' escapes the following character and is not printed.
-r
echo
.
-R
echo
command, which does not process escape sequences
unless the -e
flag is given. The -n
flag suppresses the trailing
newline. Only the -e
and -n
flags are recognized after
-R
; all other arguments and options are printed.
-m
-s
-n
-l
-N
-o
-O
-i
-o
or -O
, makes them work case
independently.
-c
-u
n
-p
-z
-D
~
expressions, as appropriate.
-P
pushd
[ arg ]
pushd
old new
pushd
{+
|-
}n
$HOME
if the PUSHD_TO_HOME
option is set or if there is only one entry on the stack.
If arg is `-
', change to $OLDPWD
, the previous directory.
If a directory named arg is not found in the current directory
and arg does not contain a slash,
search each component of the shell parameter cdpath
.
If the option CDABLE_VARS
is set, and a parameter named arg
exists whose value begins with a slash, treat its value as
the directory.
If the option PUSHD_SILENT
is not set, the directory
stack will be printed after a pushd
is performed.
The second form of pushd
substitutes the string new
for the string old in the name of the current directory,
and tries to change to this new directory.
The third form of pushd
changes directory by rotating the
directory list. An argument of the form `+
n' identifies a stack
entry by counting from the left of the list shown by the dirs
command, starting with zero. An argument of the form `-
n' counts
from the right. If the PUSHD_MINUS
option is set, the meanings
of `+
' and `-
' in this context are swapped.
pushln
[ arg ... ]
print -nz
.
pwd
[ -rLP
]
-r
or the -P
flag is specified, or the CHASE_LINKS
option is set and the -L
flag is not given, the printed path will not
contain symbolic links.
r
fc -e -
.
read
[ -rzpqAclneE
] [ -k
[ num ] ] [ -u
n ] [ name[?
prompt] ] [ name ... ]
$IFS
as separators.
-r
\
' at the end of a line does not signify line
continuation.
-q
y
' if this character was `y
' or `Y
' and to `n
' otherwise.
With this flag set the return value is zero only if the character was
`y
' or `Y
'.
-k
[ num ]
-z
-e
-E
-e
flag is set, the words are not assigned to the parameters.
-A
-c
-l
-K
flag to
compctl
). If the -c
flag is given, the words of the
current command are read. If the -l
flag is given, the whole
line is assigned as a scalar. If name is omitted then
REPLY
is used for scalars and reply
for arrays.
-n
-u
n
-p
?
', the remainder of this
word is used as a prompt on standard error when the shell
is interactive. The exit status is 0 unless an end-of-file
is encountered.
readonly
typeset -r
.
rehash
hash -r
.
return
[ n ]
.
script to return to
the invoking script with the return status specified by n. If n
is omitted, the return status is that of the last command
executed.
If return
was executed from a trap in a TRAP
NAL 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 `return
$((128+$1))
' will return the same status as if the signal had not
been trapped.
set
[ {+
|-
}options | {+
|-
}o
option_name ] ... [ {+
|-
}A
[ name ] ] [ arg ... ]
-s
option is given, it causes the
specified arguments to be sorted before assigning them to the positional
parameters (or to the array name if -A
is used). With +s
sort arguments in descending order. For the meaning of the other flags, see
section options. Flags may be specified by name using the -o
option.
If the -A
flag is specified, name is
set to an array containing the given args. if +A
is used and
name is an array, the given arguments will replace the initial
elements of that array; if no 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 `+
',
the names of all parameters are printed.
setopt
[ {+
|-
}options | {+
|-
}o
option_name ] [ name ... ]
-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 names matching these patterns are set.
shift
[ n ] [ name ... ]
${
n+1}
... are renamed
to $1
..., where n is an arithmetic expression that
defaults to 1.
If any names are given then the arrays with these names are
shifted instead of the positional parameters.
source
file [ arg ... ]
.
, except that the current directory is always searched and
is always searched first, before directories in $path
.
suspend
[ -f
]
SIGTSTP
)
until it receives a SIGCONT
.
Unless the -f
option is given, this will refuse to suspend a login shell.
test
[ arg ... ]
[
[ arg ... ] ]
test
. Added for compatibility;
use conditional expressions instead (see section Conditional Expressions).
times
trap
[ arg [ sig ... ] ]
-
', then all traps sig are reset to their
default values. If arg is the null string, then this signal
is ignored by the shell and by the commands it invokes.
If sig is ZERR
then arg will be executed
after each command with a nonzero exit status.
If sig is DEBUG
then arg will be executed
after each command.
If sig is 0
or EXIT
and the trap
statement is executed inside the body of a function,
then the command arg is executed after the function completes.
If sig is 0
or EXIT
and the trap
statement is not executed inside the body of a function,
then the command arg is executed when the shell terminates.
The trap
command with no arguments prints a list of commands
associated with each signal.
true
[ arg ... ]
ttyctl
-fu
-f
option freezes the tty, and -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 or is suspended. Thus, stty
and similar programs have
no effect when the tty is frozen. Without options it reports whether the
terminal is frozen or not.
type
[ -fpams
] name ...
whence -v
.
typeset
[ {+
|-
}LRUZfilrtuxm
[n]] [ name[=
value] ... ]
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:
-L
-Z
flag is also set.
-R
-U
PATH
or FIGNORE
,
etc.
-Z
-L
flag has not been set.
If n is nonzero it defines the width of the field;
otherwise it is determined by the width of the value of the
first assignment.
-f
-t
and -u
. The flag -t
turns on execution tracing for this
function. The flag -u
causes this function to be marked
for autoloading. The fpath
parameter will be searched to find the
function definition when the function is first referenced; see
section Functions.
-i
-l
-r
-t
-u
-x
+
' rather than `-
' 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 `+
' instead of `-
' keeps their values from being printed.
If no arguments or options are given, the names and attributes
of all parameters are printed. If only the -m
flag is given the
arguments are taken as patterns (should be quoted) and all parameters
or functions (with the -f
flag) with matching names are printed.
ulimit
[ -SHacdflmnpstv
[ limit
] ... ]
unlimited
'. If the -H
flag is given use
hard limits instead of soft limits. If the -S
flag is given
together with the -H
flag set both hard and soft limits. If no
options are used, the file size limit (-f
) is assumed. If
limit is omitted the current value of the specified resources are
printed. When more than one resource values are printed the limit name and
unit is printed before each value.
-a
-c
-d
-f
-l
-m
-n
-s
-t
-u
-v
umask
[ -S
] [ mask ]
-S
option causes the mask to be printed as a symbolic value. Otherwise,
the mask is printed as an octal number. Note that in
the symbolic form the permissions you specify are those which are to be
allowed (not denied) to the users specified.
unalias
unhash -a
.
unfunction
unhash -f
.
unhash
[ -adfm
] name ...
-a
option causes unhash
to remove aliases. The -f
option causes
unhash
to remove shell functions. The -d
options causes
unhash
to remove named directories. If the -m
flag is given
the arguments are taken as patterns (should be quoted) and all elements
of the corresponding hash table with matching names will be removed.
unlimit
[ -hs
] resource ...
-h
flag is given and the shell has appropriate privileges,
the hard resource limit for each resource is removed.
The resources of the shell process are only changed if the -s
flag is given.
unset
[ -fm
] name ...
-m
flag is specified the
arguments are taken as patterns (should be quoted) and all parameters
with matching names are unset. unset -f
is equivalent to
unfunction
.
unsetopt
[ {+
|-
}options | {+
|-
}o
option_name ] [ name ... ]
-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 names matching these patterns are unset.
wait
[ job ... ]
whence
[ -vcfpams
] name ...
-v
-c
-v
.
-f
-c
flag were used.
-p
-a
-m
-s
where
[ -pms
] name ...
whence -ca
.
which
[ -pams
] name ...
whence -c
.
zmodload
[ -iL
] [ name ... ]
zmodload
-u
[ -i
] name ...
zmodload
-d
[ -L
] [ name [ dep ... ] ]
zmodload
-du
name [ dep ... ]
zmodload
-a
[ -iL
] [ name [ builtin ... ] ]
zmodload
-au
[ -i
] builtin ...
.so
' or `name'.
If the module to be loaded is already loaded and the -i
option is given, the duplicate module is ignored. Otherwise
zmodload
prints an error message.
The named module is searched for in the same way a command is, using
$module_path
instead of $path
. If name contains a `/
',
it will be used as-is, and a path search will be performed otherwise.
This behaviour can be modified by the PATH_DIRS
option.
With -u
, zmodload
unloads modules. The same name
must be given that was given when the module was loaded, but it is not
necessary for the module to exist in the filesystem.
The -i
option suppresses the error if the module is already
unloaded (or was never loaded).
Each module has a boot and a cleanup function. The module
will not be loaded if its boot function fails. Similarily a module
can only be unloaded if its cleanup function runs successfully.
Without arguments all currently loaded binary modules are printed.
The -L
option causes this list to be in the form of a series of
zmodload
commands.
The -d
option can be used to specify module dependencies.
This operation is idempotent regardless of the -i
option.
The modules named in the second and subsequent arguments will be
loaded before the module named in the first argument.
With -d
and one
argument, all dependencies for that module are listed. With -d
and no
arguments, all module dependencies are listed.
This listing is by default in a Makefile-like format.
The -L
option changes this format to a list of
zmodload -d
commands.
If -d
and -u
are both used, dependencies are removed.
This operation is idempotent regardless of the -i
option.
If only one argument is given, all dependencies for that module are removed.
The -a
option defines autoloaded builtins. It defines the
specified builtins. When any of those builtins is called, the module
specified in the first argument is loaded. If only one argument is given,
one builtin is defined, with the same name as the module.
-i
suppresses the error if the builtin is already defined or
autoloaded, regardless of which module it came from.
With -a
and no arguments, all
autoloaded builtins are listed, with the module name (if different)
shown in parentheses after the builtin name. The -L
option changes
this format to a list of zmodload -a
commands.
If -a
is used
together with the -u
option it removes builtins defined with
zmodload -a
. This is only possible if the builtin is not yet
loaded. -i
suppresses the error if the builtin is already
removed (or never existed).
Go to the first, previous, next, last section, table of contents.