Go to the previous, next section.
. 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 [ -grm ] [ name[=value] ] ...
name=value
on the standard output. For each
name with a corresponding value, define an alias with that
value. A trailing space in value causes the next word to be
checked for alias substitution. If the -g
flag is given, 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. If only the -g
or the -r
flag is given only global or regular aliases are listed. 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. The exit status is
nonzero if a name (with no value) is given for which no
alias has been defined.þ
þ
þ
autoload [ name ... ]
fpath
variable will be searched
to find the actual function definition when the function is first
referenced.þ
bg [ job ... ]
job ... &
bindkey -mevd
bindkey -r in-string ...
bindkey [ -a ] in-string [ command ] ...
bindkey -s [ -a ] in-string out-string ...
-e
and -v
options put the keymaps in emacs mode and vi
mode respectively; they cannot be used simultaneously. The -d
option resets all bindings to the compiled-in settings. If not used
with options -e
or -v
, the maps will be left in emacs
mode, or in vi mode if the VISUAL
or EDITOR
variables
contain the string `vi'. Metafied characters are bound to
self-insert by default. The -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 -r
option is given, remove
any binding for each in-string. If the -s
option is not
specified, bind each in-string to a specified command. If
no command is specified, print the binding of in-string if
it is bound, or return a nonzero exit code if it is not bound. If the
-s
option is specified, bind each in-string to each
specified out-string. When in-string is typed,
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 -a
option is specified, bind the in-strings in the
alternative keymap instead of the standard one. The alternative keymap
is used in vi command mode.
It's possible for an 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
KEYTIMEOUT
parameter; the default is 0.4 seconds. No timeout is
done if the prefix string is not bound.
For either in-string or out-string, control characters may
be specified in the form ^X
, and the backslash may be used to
introduce one of the following escape sequences:
\a
\n
\b
\t
\v
\f
\r
\e
\E
\nnn
\xnn
\M-xxx
-
after the
M
is optional.\C-X
-
after the M
is optional.
In all other cases, \
escapes the following character. Delete is
written as ^?
. Note that \M^?
and ^\M?
are not the
same.
Multi-character in-strings cannot contain the null character
(^@
or ^
). If they appear in a bindkey command, they
will be silently translated to \M-^@
. This restriction does not
apply to out-strings, single-character in-strings and the
first character of a multi-char in-string.þ
þ
þ
for
, while
, until
,
select
, or repeat
loop. If n is specified, then
break n levels instead of just one.þ
exit
.
þ
þ
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 CDABLEVARS
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
is equivalent to popd
.
þ
cd
.
þ
þ
COMPLETE_ALIASES
option is set.) With the
-D
flag, control default completion
behavior for commands not assigned any special behavior; with
-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.
-c
-f
-o
-v
-b
-A
-I
-F
-p
-E
-j
kill
builtin).
-r
-z
-B
-a
-R
-G
-u
-d
-e
-N
-n
-O
-Z
-q
-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
AUTO_REMOVE_SLASH
option).
-k name
$name
(which should be an
array). Alternatively,
the argument 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: `compctl -k "(cputime filesize datasize
stacksize coredumpsize resident descriptors)" limit'.
-K function
reply
to an array
containing the completions (one completion per element); note that
reply
should not be made local. From such a function the command
line can be accessed with the -c
and -l
flags to the
read
builtin. Example: `function whoson { reply=(`users`);
}; compctl -K whoson talk' completes only logged-on users after
`talk'. Note that whoson
must return an array so that just
`reply=`users`' is incorrect.
-X explanation
%n
in this string is replaced by the number of matches.
-P prefix
-S suffix
-g globstring
*(/)
instead of
*/
for directories. The fignore
special parameter is not
used. More than one of these pattern may be given separated by blanks.
Note that brace expansion is not part of globbing.
-s substring
fignore
special parameter is
not used. Note that -g
is faster for filenames.
-H num pattern
*
, of course) all words are taken.
-l cmd
p[...]
, r[...]
, or R[...]
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 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
the first word, command names are completed. Example: `compctl -x
'r[-exec,;]' -l " -- find' completes the arguments between -exec
and the following ;
(or the end of the command line if there is
no such string) as if they were specifying a command on their
own.
-U
-K
option), which
can examine the word via the read
builtin's -c
and
-l
flags and use its own criterion to decide what matches.
The second form specifies alternative options. First completion is
tried with the options before the first +
. If this produces no
matches completion is tried with the flags after the +
and so on.
If there are no flags after the last +
this means that default
completion is tried if no matches were found.
The third form specifies extended completion for the commands given as
arg. Each pattern is examined in turn; when a match is
found, the corresponding flags, as described above for the
ordinary case, are used to generate possible completions. If no
pattern matches, the flags given before the -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 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
c[...][...]
, 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:
s[string] ...
S[string] ...
s[string]
but the string is part of the
completion.
p[from,to] ...
c[offset,string] ...
C[offset,pattern] ...
c
but uses pattern matching instead.
w[index,string] ...
W[index,pattern] ...
w
but uses pattern matching instead.
n[index,string] ...
N[index,string] ...
n[index,string]
but the string will be taken as
a character class (anything up to the index'th ocurrence of any of
the characters in string will not be considered part of the
completion).
m[min,max] ...
r[str1,str2]...
R[str1,str2]...
r
but uses pattern matching instead.
Example:
`compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' -
's[-f],c[-1,-f]' -f -- mail'
Complete users by default. After a -f
with an optional space,
complete file names; if a +
follows the -f
, whether or not
there is a space in between, complete with the non-directory part of
files in the directory `~/Mail'.þ
þ
þ
for
, while
,
until
, select
, or repeat
loop. If n is
specified, break out of n-1 loops and resume at the n'th
enclosing loop.þ
typeset
.
þ
þ
-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.þ
þ
þ
-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 unhash
. Builtins
can be enabled with the enable
command.þ
-n
flag is not present, print a newline at the
end. echo
recognizes the following escape sequences:
\a
\b
\c
\e
\f
\n
\r
\t
\v
\\
\0NNN
\xNN
x
. A non-hexadecimal digit terminates the number.
disable
. Without arguments the enabled builtins are printed;
with the -m
flag the arguments are taken as patterns (and hence
should be quoted), and all builtins matching these patterns are
enabled.þ
þ
EOF
condition will also cause the shell to exit, unless the
IGNORE_EOF
option is set.þ
-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 (which 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(s) 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, -f
prints full time and date
stamps, and -D
prints elapsed times. Adding the -E
flag
causes the dates to be printed in the European format
(dd.mm.yyyy).þ
þ
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
to the given file. fc -AI
(-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
SAVEHIST
entries.þ
typeset -f
.
þ
þ
þ
read -zr
. The flags
-c
, -l
, -A
, -e
, -E
, and -n
are
also supported.þ
þ
+
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.þ
fc -l
.
þ
typeset -i
, except that options irrelevant to integers
are not permitted.þ
-l
flag lists process ids, and the -p
flag
lists process groups. If the -r
flag is given only running jobs
will be listed; if the -s
flag is given only stopped jobs are
shown.þ
þ
þ
SIGTERM
or the specified signal to the given jobs or
processes. Signals are given by number or by names (with the prefix
SIG
removed). 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 second form, kill -l
, the signal names are
listed.þ
-h
flag is given, use hard limits instead of soft limits. If no
resource is given, print all limits. See also ulimit
.
resource is one of:
cputime
filesize
datasize
stacksize
coredumpsize
resident
memoryuse
memorylocked
descriptors
openfiles
vmemorysize
Which of these resource limits are available depends on the system. limit is a number, with an optional scaling factor, as follows:
nh
nk
nm
mm:ss
typeset
, except that the options -x
and -f
are not permitted.þ
þ
þ
þ
watch
parameter.þ
cd
to the new
top directory. With an argument of the form +n
, remove the
n'th entry counting from the left of the list shown by the
dirs
command, starting with zero, and change to that directory.
With an argument of the form -n
, remove the n'th entry
counting from the right. If the PUSHD_MINUS
option is set, the
meanings of +
and -
in this context are swapped.þ
-
, 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 NULL 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
-r
echo
. The -R
option
will print all subsequent arguments and options.-s
-n
-l
-N
-o
-O
-i
-o
or -O
, makes the sort be
case-insensitive.-c
-un
-p
-z
-D
~
expressions, as appropriate.-P
PROMPT
parameter.
HOME
if the PUSHD_TO_HOME
option is
set or if there is only one entry on the stack. 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 contain a slash, search each component of the shell
parameter cdpath
. If the option CDABLEVARS
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
is equivalent to popd
.
þ
print -nZ
.
þ
print -R $PWD
.
þ
fc -e -
.
þ
þ
IFS
as separators. In raw mode, -r
, a \
at the end
of a line does not signify line continuation. With the -q
flag
read only one character and set name to `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'.
If the -k
flag is given read only one (or num) characters. If the -z
flag is given, read from the editor buffer stack. The first field is
assigned to the first name, the second field to the second
name, etc, with leftover fields assigned to the last name.
If the -e
or the -E
flag is given, the words read are
printed after the whole line is read. If the -e
flag is given,
the words are not assigned to the parameters. If the -A
flag is
given, the first name is taken as the name of an array and all
words are assigned to it. If name is omitted then REPLY
is
used for scalars and reply
for arrays. The -c
and
-l
flags are allowed only if called inside a function used for
completion (specified with the -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.
Together with the -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 -un
is specified, then input is read from
file descriptor n; if -p
is specified, then input is read
from the coprocess. If the first argument contains a ?
, 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.þ
þ
-f
option is given, rescan the command path immediately, instead of
rebuilding the hash table incrementally.þ
þ
.
script to return to the invoking
script with the return status specified by n. If n is
omitted then the return status is that of the last command
executed.
If return
was executed from a trap, whether set by the
trap
builtin or by defining a TRAPxxx
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.þ
þ
þ
-item
, removes the given item from the list.þ
þ
þ
þ
-o
option. If the -A
flag is given, name is set to an array containing the given
args; 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.þ
þ
-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.þ
þ
$n+1
... are renamed
$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.þ
path
.þ
þ
SIGTSTP
) until it
receives a SIGCONT
. If the -f
option is not given,
complain if this is a login shell.þ
test
. Added for compatibility; use
conditional expressions instead.þ
þ
þ
$1
refers to the number of the
signal that caused the trap.
If arg is -
, 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.þ
-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. Thus,
stty
and similar programs have no effect when the tty is
frozen. Without options it reports whether the terminal is frozen or
not.þ
whence -v
.
þ
þ
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 given.
-R
-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.
-i
-l
-r
-t
-u
-x
Using +
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 just the -m
flag is given the
arguments are taken as patterns (which should be quoted), and all
parameters or functions (with the -f
flag) with matching names
are printed.þ
þ
þ
-H
flag is given use hard limits instead of soft limits. See also
limit
.
-a
-c
-d
-f
-l
-m
-n
-o
-p
-s
-t
-v
chmod(1)
. If
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).þ
þ
-m
flag, the arguments are taken as patterns (which should be
quoted), and all aliases with matching names are removed.þ
þ
-m
flag, the arguments are taken as patterns (which should be
quoted), and all function with matching names are removed.þ
-m
flag, the arguments are taken as patterns
(which should be quoted), and all entries for commands with matching
names are removed.þ
þ
þ
-h
flag is given and the shell is running as root, the hard
resource limit for each resource is removed.þ
þ
-m
flag, the arguments
are taken as patterns (which should be quoted), and all parameters with
matching names are unset.þ
þ
-m
flag, the arguments are
taken as patterns (which should be quoted), and all options with
matching names are unset.þ
þ
þ
-c
flag
is given, the parameter is created if it doesn't already exist. If the
-p
flag is given, prompt will be taken as the prompt to
display at the left. If the -r
flag is given, rprompt will
be taken as the prompt to display at the right.þ
þ
þ
-v
flag produces a more verbose report. The -p
flag does a path search for name even if it is a shell function,
alias, or reserved word. The -c
flag prints the results in a
csh-like format. The -a
flag does a search for all occurences of
name throughout the command path. With the -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.þ
whence -c
.
Go to the previous, next section.