"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Doc/zsh.info-4" between
zsh-5.8.1-doc.tar.xz and zsh-5.9-doc.tar.xz

About: Zsh is a powerful UNIX command interpreter (shell). Documentation.

zsh.info-4  (zsh-5.8.1-doc.tar.xz):zsh.info-4  (zsh-5.9-doc.tar.xz)
skipping to change at line 64 skipping to change at line 64
_alternative [ -O NAME ] [ -C NAME ] SPEC ... _alternative [ -O NAME ] [ -C NAME ] SPEC ...
This function is useful in simple cases where multiple tags are This function is useful in simple cases where multiple tags are
available. Essentially it implements a loop like the one available. Essentially it implements a loop like the one
described for the _tags function below. described for the _tags function below.
The tags to use and the action to perform if a tag is requested are The tags to use and the action to perform if a tag is requested are
described using the SPECs which are of the form: described using the SPECs which are of the form:
`TAG:DESCR:ACTION'. The TAGs are offered using _tags and if the `TAG:DESCR:ACTION'. The TAGs are offered using _tags and if the
tag is requested, the ACTION is executed with the given tag is requested, the ACTION is executed with the given
description DESCR. The ACTIONs are those accepted by the description DESCR. The ACTIONs are those accepted by the
_arguments function (described below), excluding the `->STATE' and _arguments function (described below), with the following
`=...' forms. exceptions:
* The `->STATE' and `=...' forms are not supported.
* The `((a\:bar b\:baz))' form does not need the colon to be
escaped, since the SPECs have no colon-separated fields after
the ACTION.
For example, the ACTION may be a simple function call: For example, the ACTION may be a simple function call:
_alternative \ _alternative \
'users:user:_users' \ 'users:user:_users' \
'hosts:host:_hosts' 'hosts:host:_hosts'
offers usernames and hostnames as possible matches, generated by offers usernames and hostnames as possible matches, generated by
the _users and _hosts functions respectively. the _users and _hosts functions respectively.
skipping to change at line 194 skipping to change at line 199
Pass the elements of the array NAME as arguments to functions Pass the elements of the array NAME as arguments to functions
called to execute ACTIONs. This is discussed in detail below. called to execute ACTIONs. This is discussed in detail below.
-M MATCHSPEC -M MATCHSPEC
Use the match specification MATCHSPEC for completing option Use the match specification MATCHSPEC for completing option
names and values. The default MATCHSPEC allows partial word names and values. The default MATCHSPEC allows partial word
completion after `_' and `-', such as completing `-f-b' to completion after `_' and `-', such as completing `-f-b' to
`-foo-bar'. The default MATCHSPEC is: `-foo-bar'. The default MATCHSPEC is:
r:|[_-]=* r:|=* r:|[_-]=* r:|=*
-0
When populating values of the `opt_args' associative array,
don't backslash-escape colons and backslashes and use NUL
rather than colon for joining multiple values. This option is
described in more detail below, under the heading _SPECs:
actions_.
_SPECs: overview_ _SPECs: overview_
Each of the following forms is a SPEC describing individual sets of Each of the following forms is a SPEC describing individual sets of
options or arguments on the command line being analyzed. options or arguments on the command line being analyzed.
N:MESSAGE:ACTION N:MESSAGE:ACTION
N::MESSAGE:ACTION N::MESSAGE:ACTION
This describes the N'th normal argument. The MESSAGE will be This describes the N'th normal argument. The MESSAGE will be
printed above the matches generated and the ACTION indicates printed above the matches generated and the ACTION indicates
what can be completed in this position (see below). If there what can be completed in this position (see below). If there
skipping to change at line 489 skipping to change at line 501
`expl'; this will be set up before executing the ACTION and `expl'; this will be set up before executing the ACTION and
hence may be referred to inside it, typically in an expansion hence may be referred to inside it, typically in an expansion
of the form `$expl[@]' which preserves empty elements of the of the form `$expl[@]' which preserves empty elements of the
array. array.
During the performance of the action the array `line' will be set During the performance of the action the array `line' will be set
to the normal arguments from the command line, i.e. the words from to the normal arguments from the command line, i.e. the words from
the command line after the command name excluding all options and the command line after the command name excluding all options and
their arguments. Options are stored in the associative array their arguments. Options are stored in the associative array
`opt_args' with option names as keys and their arguments as the `opt_args' with option names as keys and their arguments as the
values. For options that have more than one argument these are values. By default, all colons and backslashes in the value are
given as one string, separated by colons. All colons and escaped with backslashes, and if an option has multiple arguments
backslashes in the original arguments are preceded with (for example, when using an OPTSPEC of the form `*OPTSPEC'), they
backslashes. are joined with (unescaped) colons. However, if the -0 option was
passed, no backslash escaping is performed, and multiple values
are joined with NUL bytes. For example, after `zsh -o foo:foo -o
bar:bar -o <TAB>', the contents of `opt_args' would be
typeset -A opt_args=( [-o]='foo\:foo:bar\:bar:' )
by default, and
typeset -A opt_args=( [-o]=$'foo:foo\x00bar:bar\x00' )
if _arguments had been called with the -0 option.
The parameter `context' is set when returning to the calling The parameter `context' is set when returning to the calling
function to perform an action of the form `->STRING'. It is set function to perform an action of the form `->STRING'. It is set
to an array of elements corresponding to the elements of $state. to an array of elements corresponding to the elements of $state.
Each element is a suitable name for the argument field of the Each element is a suitable name for the argument field of the
context: either a string of the form `option-OPT-N' for the N'th context: either a string of the form `option-OPT-N' for the N'th
argument of the option -OPT, or a string of the form `argument-N' argument of the option -OPT, or a string of the form `argument-N'
for the N'th argument. For `rest' arguments, that is those in the for the N'th argument. For `rest' arguments, that is those in the
list at the end not handled by position, N is the string `rest'. list at the end not handled by position, N is the string `rest'.
For example, when completing the argument of the -o option, the For example, when completing the argument of the -o option, the
skipping to change at line 709 skipping to change at line 732
The `-copy' option may appear more than once on the command line The `-copy' option may appear more than once on the command line
and takes two arguments. The first is mandatory and will be and takes two arguments. The first is mandatory and will be
completed as a filename. The second is optional (because of the completed as a filename. The second is optional (because of the
second colon before the description `RESOLUTION') and will be second colon before the description `RESOLUTION') and will be
completed from the strings `300' and `600'. completed from the strings `300' and `600'.
The last two descriptions say what should be completed as The last two descriptions say what should be completed as
arguments. The first describes the first argument as a arguments. The first describes the first argument as a
`POSTSCRIPT FILE' and makes files ending in `ps' or `eps' be `POSTSCRIPT FILE' and makes files ending in `ps' or `eps' be
completed. The last description gives all other arguments the completed. The last description gives all other arguments the
description `PAGE NUMBERS' but does not offer completions. description `PAGE NUMBER' but does not offer completions.
_cache_invalid CACHE_IDENTIFIER _cache_invalid CACHE_IDENTIFIER
This function returns status zero if the completions cache This function returns status zero if the completions cache
corresponding to the given cache identifier needs rebuilding. It corresponding to the given cache identifier needs rebuilding. It
determines this by looking up the cache-policy style for the determines this by looking up the cache-policy style for the
current context. This should provide a function name which is run current context. This should provide a function name which is run
with the full path to the relevant cache file as the only argument. with the full path to the relevant cache file as the only argument.
Example: Example:
skipping to change at line 826 skipping to change at line 849
This function should normally be run only in a subshell, because This function should normally be run only in a subshell, because
the new locale is exported to the environment. Typical usage would the new locale is exported to the environment. Typical usage would
be `$(_comp_locale; COMMAND ...)'. be `$(_comp_locale; COMMAND ...)'.
_completers [ -p ] _completers [ -p ]
This function completes names of completers. This function completes names of completers.
-p -p
Include the leading underscore (`_') in the matches. Include the leading underscore (`_') in the matches.
_default
This function corresponds to the -default- special context which is
applied where no completion is defined. It is useful to call it
under certain error conditions such as completion after an
unrecognised subcommand. This applies the concept of graceful
degradation to the completion system, allowing it to fallback on
basic completion of commonly useful things like filenames.
_describe [-12JVx] [ -oO | -t TAG ] DESCR NAME1 [ NAME2 ] [ OPT ... ] _describe [-12JVx] [ -oO | -t TAG ] DESCR NAME1 [ NAME2 ] [ OPT ... ]
[ -- NAME1 [ NAME2 ] [ OPT ... ] ... ] [ -- NAME1 [ NAME2 ] [ OPT ... ] ... ]
This function associates completions with descriptions. Multiple This function associates completions with descriptions. Multiple
groups separated by -- can be supplied, potentially with different groups separated by -- can be supplied, potentially with different
completion options OPTs. completion options OPTs.
The DESCR is taken as a string to display above the matches if the The DESCR is taken as a string to display above the matches if the
format style for the descriptions tag is set. This is followed by format style for the descriptions tag is set. This is followed by
one or two names of arrays followed by options to pass to compadd. one or two names of arrays followed by options to pass to compadd.
The array NAME1 contains the possible completions with their The array NAME1 contains the possible completions with their
skipping to change at line 896 skipping to change at line 927
so that the sequence `%d' is replaced by the DESCR given as the so that the sequence `%d' is replaced by the DESCR given as the
third argument without any leading or trailing white space. If, third argument without any leading or trailing white space. If,
after removing the white space, the DESCR is the empty string, the after removing the white space, the DESCR is the empty string, the
format style will not be used and the options put into the NAME format style will not be used and the options put into the NAME
array will not contain an explanation string to be displayed above array will not contain an explanation string to be displayed above
the matches. the matches.
If _description is called with more than three arguments, the If _description is called with more than three arguments, the
additional SPECs should be of the form `CHAR:STR'. These supply additional SPECs should be of the form `CHAR:STR'. These supply
escape sequence replacements for the format style: every escape sequence replacements for the format style: every
appearance of `%CHAR' will be replaced by STRING. appearance of `%CHAR' will be replaced by STRING. If no
additional SPECs are given but the description in DESCR conforms
to a common form then further escape sequences are set for
elements of that description. These elements correspond to a
default value (`%o'), the units (`%m') range of acceptable values
(`%r') and the remaining initial part of the description (`%h').
The form the description takes consists of specifying the units and
range in parentheses and the default value in square brackets, for
example:
_description times expl 'timeout (seconds) (0-60) [20]'
It is possible to use zformat conditional expressions when styling
these elements. So, for example, to add `default:' as a tag but
only when there is a default value to show, the format style might
include `%(o.default: %o.)'.
If the -x option is given, the description will be passed to If the -x option is given, the description will be passed to
compadd using the -x option instead of the default -X. This means compadd using the -x option instead of the default -X. This means
that the description will be displayed even if there are no that the description will be displayed even if there are no
corresponding matches. corresponding matches.
The options placed in the array NAME take account of the The options placed in the array NAME take account of the
group-name style, so matches are placed in a separate group where group-name style, so matches are placed in a separate group where
necessary. The group normally has its elements sorted (by passing necessary. The group normally has its elements sorted (by passing
the option -J to compadd), but if an option starting with `-V', the option -J to compadd), but if an option starting with `-V',
skipping to change at line 1143 skipping to change at line 1189
Append PRECOMMAND to the list of precommands. This option Append PRECOMMAND to the list of precommands. This option
should be used in nearly all cases in which -P is not should be used in nearly all cases in which -P is not
applicable. applicable.
If the command name matches one of the patterns given by one of the If the command name matches one of the patterns given by one of the
options -p or -P to compdef, the corresponding completion function options -p or -P to compdef, the corresponding completion function
is called and then the parameter _compskip is checked. If it is is called and then the parameter _compskip is checked. If it is
set completion is terminated at that point even if no matches have set completion is terminated at that point even if no matches have
been found. This is the same effect as in the -first- context. been found. This is the same effect as in the -first- context.
_numbers [ OPTION ... ] [ DESCRIPTION ] [ SUFFIX ... ]
This can be used where a number is followed by a suffix to
indicate the units. The unit suffixes are completed and can also
be included in the description used when completion is invoked for
the preceding number.
In addition to common compadd options, _numbers accepts the
following options:
-t TAG
Specify a tag to use instead of the default of numbers.
-u UNITS
Indicate the default units for the number, e.g. bytes.
-l MIN
Specify the lowest possible value for the number.
-m MAX
Specify the highest possible value for the number.
-d DEFAULT
Specify the default value.
-N
Allow negative numbers. This is implied if the range
includes a negative.
-f
Allow decimal numbers.
Where a particular suffix represents the default units for a
number, it should be prefixed with a colon. Additionally,
suffixes can be followed by a colon and a description. So for
example, the following allows the age of something to be
specified, either in seconds or with an optional suffix with a
longer unit of time:
_numbers -u seconds age :s:seconds m:minutes h:hours d:days
It is typically helpful for units to be presented in order of
magnitude when completed. To facilitate this, the order in which
they are given is preserved.
When the format style is looked up with the descriptions tag or
the tag specified with -t, the list of suffixes is available as a
`%x' escape sequence. This is in addition to the usual sequences
documented under the format style. The form this list takes can
also be configured. To this end, the format style is first looked
up with the tag unit-suffixes. The retrieved format is applied to
each suffix in turn and the results are then concatenated to form
the completed list. For the unit-suffixes format, `%x' expands to
the individual suffix and `%X' to its description. %d' indicates a
default suffix and can be used in a condition. The index and
reverse index are set in `%i' and `%r' respectively and are useful
for text included only with the first and last suffixes in the
list. So for example, the following joins the suffixes together as
a comma-separated list:
zstyle ':completion:*:unit-suffixes' format '%x%(r::,)'
_options _options
This can be used to complete the names of shell options. It This can be used to complete the names of shell options. It
provides a matcher specification that ignores a leading `no', provides a matcher specification that ignores a leading `no',
ignores underscores and allows upper-case letters to match their ignores underscores and allows upper-case letters to match their
lower-case counterparts (for example, `glob', `noglob', `NO_GLOB' lower-case counterparts (for example, `glob', `noglob', `NO_GLOB'
are all completed). Any arguments are propagated to the compadd are all completed). Any arguments are propagated to the compadd
builtin. builtin.
_options_set and _options_unset _options_set and _options_unset
These functions complete only set or unset options, with the same These functions complete only set or unset options, with the same
skipping to change at line 1658 skipping to change at line 1765
arguments to be passed to _description. However, in this case the arguments to be passed to _description. However, in this case the
COMMAND is not optional; all the processing of tags, including COMMAND is not optional; all the processing of tags, including
the loop over both tags and tag labels and the generation of the loop over both tags and tag labels and the generation of
matches, is carried out automatically by _wanted. matches, is carried out automatically by _wanted.
Hence to offer only one tag and immediately add the corresponding Hence to offer only one tag and immediately add the corresponding
matches with the given description: matches with the given description:
local expl local expl
_wanted tag expl 'description' \ _wanted tag expl 'description' \
compadd matches... compadd -- MATCH1 MATCH2...
See also the use of _wanted in the example function in *Note
Dynamic named directories::.
Note that, as for _requested, the COMMAND must be able to accept Note that, as for _requested, the COMMAND must be able to accept
options to be passed down to compadd. options to be passed down to compadd.
Like _tags this function supports the -C option to give a Like _tags this function supports the -C option to give a
different name for the argument context field. The -x option has different name for the argument context field. The -x option has
the same meaning as for _description. the same meaning as for _description.
_widgets [ -g PATTERN ] _widgets [ -g PATTERN ]
This function completes names of zle widgets (see *Note Zle This function completes names of zle widgets (see *Note Zle
skipping to change at line 2545 skipping to change at line 2655
zsh/net/tcp zsh/net/tcp
Manipulation of TCP sockets Manipulation of TCP sockets
zsh/termcap zsh/termcap
Interface to the termcap database. Interface to the termcap database.
zsh/terminfo zsh/terminfo
Interface to the terminfo database. Interface to the terminfo database.
zsh/watch
Reporting of login and logout events.
zsh/zftp zsh/zftp
A builtin FTP client. A builtin FTP client.
zsh/zle zsh/zle
The Zsh Line Editor, including the bindkey and vared builtins. The Zsh Line Editor, including the bindkey and vared builtins.
zsh/zleparameter zsh/zleparameter
Access to internals of the Zsh Line Editor via parameters. Access to internals of the Zsh Line Editor via parameters.
zsh/zprof zsh/zprof
skipping to change at line 2598 skipping to change at line 2711
* The zsh/pcre Module:: * The zsh/pcre Module::
* The zsh/param/private Module:: * The zsh/param/private Module::
* The zsh/regex Module:: * The zsh/regex Module::
* The zsh/sched Module:: * The zsh/sched Module::
* The zsh/net/socket Module:: * The zsh/net/socket Module::
* The zsh/stat Module:: * The zsh/stat Module::
* The zsh/system Module:: * The zsh/system Module::
* The zsh/net/tcp Module:: * The zsh/net/tcp Module::
* The zsh/termcap Module:: * The zsh/termcap Module::
* The zsh/terminfo Module:: * The zsh/terminfo Module::
* The zsh/watch Module::
* The zsh/zftp Module:: * The zsh/zftp Module::
* The zsh/zle Module:: * The zsh/zle Module::
* The zsh/zleparameter Module:: * The zsh/zleparameter Module::
* The zsh/zprof Module:: * The zsh/zprof Module::
* The zsh/zpty Module:: * The zsh/zpty Module::
* The zsh/zselect Module:: * The zsh/zselect Module::
* The zsh/zutil Module:: * The zsh/zutil Module::
 
File: zsh.info, Node: The zsh/attr Module, Next: The zsh/cap Module, Up: Zsh Modules File: zsh.info, Node: The zsh/attr Module, Next: The zsh/cap Module, Up: Zsh Modules
skipping to change at line 3367 skipping to change at line 3481
zcurses_keycodes below. Other keys cause a value to be set in zcurses_keycodes below. Other keys cause a value to be set in
PARAM as before. On a successful return only one of PARAM or PARAM as before. On a successful return only one of PARAM or
KPARAM contains a non-empty string; the other is set to an empty KPARAM contains a non-empty string; the other is set to an empty
string. string.
If MPARAM is also supplied, input attempts to handle mouse input. If MPARAM is also supplied, input attempts to handle mouse input.
This is only available with the ncurses library; mouse handling This is only available with the ncurses library; mouse handling
can be detected by checking for the exit status of `zcurses mouse' can be detected by checking for the exit status of `zcurses mouse'
with no arguments. If a mouse button is clicked (or double- or with no arguments. If a mouse button is clicked (or double- or
triple-clicked, or pressed or released with a configurable delay triple-clicked, or pressed or released with a configurable delay
from being clicked) then kparam is set to the string MOUSE, and from being clicked) then KPARAM is set to the string MOUSE, and
MPARAM is set to an array consisting of the following elements: MPARAM is set to an array consisting of the following elements:
- -
An identifier to discriminate different input devices; this An identifier to discriminate different input devices; this
is only rarely useful. is only rarely useful.
- -
The x, y and z coordinates of the mouse click relative to the The x, y and z coordinates of the mouse click relative to the
full screen, as three elements in that order (i.e. the y full screen, as three elements in that order (i.e. the y
coordinate is, unusually, after the x coordinate). The z coordinate is, unusually, after the x coordinate). The z
coordinate is only available for a few unusual input devices coordinate is only available for a few unusual input devices
skipping to change at line 3490 skipping to change at line 3604
`zcurses delwin'. `zcurses delwin'.
 
File: zsh.info, Node: The zsh/datetime Module, Next: The zsh/db/gdbm Module, Prev: The zsh/curses Module, Up: Zsh Modules File: zsh.info, Node: The zsh/datetime Module, Next: The zsh/db/gdbm Module, Prev: The zsh/curses Module, Up: Zsh Modules
22.10 The zsh/datetime Module 22.10 The zsh/datetime Module
============================= =============================
The zsh/datetime module makes available one builtin command: The zsh/datetime module makes available one builtin command:
strftime [ -s SCALAR ] FORMAT [ EPOCHTIME [ NANOSECONDS ] ] strftime [ -s SCALAR | -n ] FORMAT [ EPOCHTIME [ NANOSECONDS ] ]
strftime -r [ -q ] [ -s SCALAR ] FORMAT TIMESTRING strftime -r [ -q ] [ -s SCALAR | -n ] FORMAT TIMESTRING
Output the date in the FORMAT specified. With no EPOCHTIME, the Output the date in the FORMAT specified. With no EPOCHTIME, the
current system date/time is used; optionally, EPOCHTIME may be current system date/time is used; optionally, EPOCHTIME may be
used to specify the number of seconds since the epoch, and used to specify the number of seconds since the epoch, and
NANOSECONDS may additionally be used to specify the number of NANOSECONDS may additionally be used to specify the number of
nanoseconds past the second (otherwise that number is assumed to nanoseconds past the second (otherwise that number is assumed to
be 0). See man page strftime(3) for details. The zsh extensions be 0). See strftime(3) for details. The zsh extensions described
described in *Note Prompt Expansion:: are also available. in *Note Prompt Expansion:: are also available.
-n
Suppress printing a newline after the formatted string.
-q -q
Run quietly; suppress printing of all error messages Run quietly; suppress printing of all error messages
described below. Errors for invalid EPOCHTIME values are described below. Errors for invalid EPOCHTIME values are
always printed. always printed.
-r -r
With the option -r (reverse), use FORMAT to parse the input With the option -r (reverse), use FORMAT to parse the input
string TIMESTRING and output the number of seconds since the string TIMESTRING and output the number of seconds since the
epoch at which the time occurred. The parsing is implemented epoch at which the time occurred. The parsing is implemented
by the system function strptime; see man page strptime(3). by the system function strptime; see strptime(3). This means
This means that zsh format extensions are not available, but that zsh format extensions are not available, but for reverse
for reverse lookup they are not required. lookup they are not required.
In most implementations of strftime any timezone in the In most implementations of strftime any timezone in the
TIMESTRING is ignored and the local timezone declared by the TIMESTRING is ignored and the local timezone declared by the
TZ environment variable is used; other parameters are set to TZ environment variable is used; other parameters are set to
zero if not present. zero if not present.
If TIMESTRING does not match FORMAT the command returns If TIMESTRING does not match FORMAT the command returns
status 1 and prints an error message. If TIMESTRING matches status 1 and prints an error message. If TIMESTRING matches
FORMAT but not all characters in TIMESTRING were used, the FORMAT but not all characters in TIMESTRING were used, the
conversion succeeds but also prints an error message. conversion succeeds but also prints an error message.
skipping to change at line 3775 skipping to change at line 3892
directory then it will be removed, instead of followed. If this directory then it will be removed, instead of followed. If this
option is used with multiple filenames and the target is a option is used with multiple filenames and the target is a
symbolic link pointing to a directory then the result is an error. symbolic link pointing to a directory then the result is an error.
mkdir [ -p ] [ -m MODE ] DIR ... mkdir [ -p ] [ -m MODE ] DIR ...
Creates directories. With the -p option, non-existing parent Creates directories. With the -p option, non-existing parent
directories are first created if necessary, and there will be no directories are first created if necessary, and there will be no
complaint if the directory already exists. The -m option can be complaint if the directory already exists. The -m option can be
used to specify (in octal) a set of file permissions for the used to specify (in octal) a set of file permissions for the
created directories, otherwise mode 777 modified by the current created directories, otherwise mode 777 modified by the current
umask (see man page umask(2)) is used. umask (see umask(2)) is used.
mv [ -fi ] FILENAME DEST mv [ -fi ] FILENAME DEST
mv [ -fi ] FILENAME ... DIR mv [ -fi ] FILENAME ... DIR
Moves files. In the first form, the specified FILENAME is moved Moves files. In the first form, the specified FILENAME is moved
to the specified DESTination. In the second form, each of the to the specified DESTination. In the second form, each of the
FILENAMEs is taken in turn, and moved to a pathname in the FILENAMEs is taken in turn, and moved to a pathname in the
specified DIRectory that has the same last pathname component. specified DIRectory that has the same last pathname component.
By default, the user will be queried before replacing any file By default, the user will be queried before replacing any file
that the user cannot write to, but writable files will be silently that the user cannot write to, but writable files will be silently
skipping to change at line 3801 skipping to change at line 3918
Note that this mv will not move files across devices. Historical Note that this mv will not move files across devices. Historical
versions of mv, when actual renaming is impossible, fall back on versions of mv, when actual renaming is impossible, fall back on
copying and removing files; if this behaviour is desired, use cp copying and removing files; if this behaviour is desired, use cp
and rm manually. This may change in a future version. and rm manually. This may change in a future version.
rm [ -dfiRrs ] FILENAME ... rm [ -dfiRrs ] FILENAME ...
Removes files and directories specified. Removes files and directories specified.
Normally, rm will not remove directories (except with the -R or -r Normally, rm will not remove directories (except with the -R or -r
options). The -d option causes rm to try removing directories options). The -d option causes rm to try removing directories
with unlink (see man page unlink(2)), the same method used for with unlink (see unlink(2)), the same method used for files.
files. Typically only the super-user can actually succeed in Typically only the super-user can actually succeed in unlinking
unlinking directories in this way. -d takes precedence over -R directories in this way. -d takes precedence over -R and -r.
and -r.
By default, the user will be queried before removing any file that By default, the user will be queried before removing any file that
the user cannot write to, but writable files will be silently the user cannot write to, but writable files will be silently
removed. The -i option causes the user to be queried about removed. The -i option causes the user to be queried about
removing any files. The -f option causes files to be silently removing any files. The -f option causes files to be silently
deleted, without querying, and suppresses all error indications. deleted, without querying, and suppresses all error indications.
-f takes precedence. -f takes precedence.
The -R and -r options cause rm to recursively descend into The -R and -r options cause rm to recursively descend into
directories, deleting all files in the directory before removing directories, deleting all files in the directory before removing
the directory with the rmdir system call (see man page rmdir(2)). the directory with the rmdir system call (see rmdir(2)).
The -s option is a zsh extension to rm functionality. It enables The -s option is a zsh extension to rm functionality. It enables
paranoid behaviour, intended to avoid common security problems paranoid behaviour, intended to avoid common security problems
involving a root-run rm being tricked into removing files other involving a root-run rm being tricked into removing files other
than the ones intended. It will refuse to follow symbolic links, than the ones intended. It will refuse to follow symbolic links,
so that (for example) ``rm /tmp/foo/passwd'' can't accidentally so that (for example) ``rm /tmp/foo/passwd'' can't accidentally
remove /etc/passwd if /tmp/foo happens to be a link to /etc. It remove /etc/passwd if /tmp/foo happens to be a link to /etc. It
will also check where it is after leaving directories, so that a will also check where it is after leaving directories, so that a
recursive removal of a deep directory tree can't end up recursive removal of a deep directory tree can't end up
recursively removing /usr as a result of directories being moved recursively removing /usr as a result of directories being moved
up the tree. up the tree.
rmdir DIR ... rmdir DIR ...
Removes empty directories specified. Removes empty directories specified.
sync sync
Calls the system call of the same name (see man page sync(2)), Calls the system call of the same name (see sync(2)), which
which flushes dirty buffers to disk. It might return before the flushes dirty buffers to disk. It might return before the I/O has
I/O has actually been completed. actually been completed.
 
File: zsh.info, Node: The zsh/langinfo Module, Next: The zsh/mapfile Module, Prev: The zsh/files Module, Up: Zsh Modules File: zsh.info, Node: The zsh/langinfo Module, Next: The zsh/mapfile Module, Prev: The zsh/files Module, Up: Zsh Modules
22.15 The zsh/langinfo Module 22.15 The zsh/langinfo Module
============================= =============================
The zsh/langinfo module makes available one parameter: The zsh/langinfo module makes available one parameter:
langinfo langinfo
skipping to change at line 3870 skipping to change at line 3986
The zsh/mapfile module provides one special associative array The zsh/mapfile module provides one special associative array
parameter of the same name. parameter of the same name.
mapfile mapfile
This associative array takes as keys the names of files; the This associative array takes as keys the names of files; the
resulting value is the content of the file. The value is treated resulting value is the content of the file. The value is treated
identically to any other text coming from a parameter. The value identically to any other text coming from a parameter. The value
may also be assigned to, in which case the file in question is may also be assigned to, in which case the file in question is
written (whether or not it originally existed); or an element may written (whether or not it originally existed); or an element may
be unset, which will delete the file in question. For example, be unset, which will delete the file in question. For example,
`vared mapfile[myfile]' works as expected, editing the file `vared 'mapfile[myfile]'' works as expected, editing the file
`myfile'. `myfile'.
When the array is accessed as a whole, the keys are the names of When the array is accessed as a whole, the keys are the names of
files in the current directory, and the values are empty (to save files in the current directory, and the values are empty (to save
a huge overhead in memory). Thus ${(k)mapfile} has the same a huge overhead in memory). Thus ${(k)mapfile} has the same
effect as the glob operator *(D), since files beginning with a dot effect as the glob operator *(D), since files beginning with a dot
are not special. Care must be taken with expressions such as rm are not special. Care must be taken with expressions such as rm
${(k)mapfile}, which will delete every file in the current ${(k)mapfile}, which will delete every file in the current
directory without the usual `rm *' test. directory without the usual `rm *' test.
skipping to change at line 3944 skipping to change at line 4060
The following functions take a single floating point argument: acos, The following functions take a single floating point argument: acos,
acosh, asin, asinh, atan, atanh, cbrt, ceil, cos, cosh, erf, erfc, exp, acosh, asin, asinh, atan, atanh, cbrt, ceil, cos, cosh, erf, erfc, exp,
expm1, fabs, floor, gamma, j0, j1, lgamma, log, log10, log1p, log2, expm1, fabs, floor, gamma, j0, j1, lgamma, log, log10, log1p, log2,
logb, sin, sinh, sqrt, tan, tanh, y0, y1. The atan function can logb, sin, sinh, sqrt, tan, tanh, y0, y1. The atan function can
optionally take a second argument, in which case it behaves like the C optionally take a second argument, in which case it behaves like the C
function atan2. The ilogb function takes a single floating point function atan2. The ilogb function takes a single floating point
argument, but returns an integer. argument, but returns an integer.
The function signgam takes no arguments, and returns an integer, which The function signgam takes no arguments, and returns an integer, which
is the C variable of the same name, as described in man page gamma(3). is the C variable of the same name, as described in gamma(3). Note
Note that it is therefore only useful immediately after a call to gamma that it is therefore only useful immediately after a call to gamma or
or lgamma. Note also that `signgam()' and `signgam' are distinct lgamma. Note also that `signgam()' and `signgam' are distinct
expressions. expressions.
The functions min, max, and sum are defined not in this module but in The functions min, max, and sum are defined not in this module but in
the zmathfunc autoloadable function, described in *Note Mathematical the zmathfunc autoloadable function, described in *Note Mathematical
Functions::. Functions::.
The following functions take two floating point arguments: copysign, The following functions take two floating point arguments: copysign,
fmod, hypot, nextafter. fmod, hypot, nextafter.
The following take an integer first argument and a floating point second The following take an integer first argument and a floating point second
skipping to change at line 4234 skipping to change at line 4350
jobdirs jobdirs
This associative array maps job numbers to the directories from This associative array maps job numbers to the directories from
which the job was started (which may not be the current directory which the job was started (which may not be the current directory
of the job). of the job).
The keys of the associative arrays are usually valid job numbers, The keys of the associative arrays are usually valid job numbers,
and these are the values output with, for example, ${(k)jobdirs}. and these are the values output with, for example, ${(k)jobdirs}.
Non-numeric job references may be used when looking up a value; Non-numeric job references may be used when looking up a value;
for example, ${jobdirs[%+]} refers to the current job. for example, ${jobdirs[%+]} refers to the current job.
See the jobs builtin for how job information is provided in a
subshell.
jobtexts jobtexts
This associative array maps job numbers to the texts of the This associative array maps job numbers to the texts of the
command lines that were used to start the jobs. command lines that were used to start the jobs.
Handling of the keys of the associative array is as described for Handling of the keys of the associative array is as described for
jobdirs above. jobdirs above.
See the jobs builtin for how job information is provided in a
subshell.
jobstates jobstates
This associative array gives information about the states of the This associative array gives information about the states of the
jobs currently known. The keys are the job numbers and the values jobs currently known. The keys are the job numbers and the values
are strings of the form `JOB-STATE:MARK:PID=STATE...'. The are strings of the form `JOB-STATE:MARK:PID=STATE...'. The
JOB-STATE gives the state the whole job is currently in, one of JOB-STATE gives the state the whole job is currently in, one of
`running', `suspended', or `done'. The MARK is `+' for the current `running', `suspended', or `done'. The MARK is `+' for the current
job, `-' for the previous job and empty otherwise. This is job, `-' for the previous job and empty otherwise. This is
followed by one `:PID=STATE' for every process in the job. The followed by one `:PID=STATE' for every process in the job. The
PIDs are, of course, the process IDs and the STATE describes the PIDs are, of course, the process IDs and the STATE describes the
state of that process. state of that process.
Handling of the keys of the associative array is as described for Handling of the keys of the associative array is as described for
jobdirs above. jobdirs above.
See the jobs builtin for how job information is provided in a
subshell.
nameddirs nameddirs
This associative array maps the names of named directories to the This associative array maps the names of named directories to the
pathnames they stand for. pathnames they stand for.
userdirs userdirs
This associative array maps user names to the pathnames of their This associative array maps user names to the pathnames of their
home directories. home directories.
usergroups usergroups
This associative array maps names of system groups of which the This associative array maps names of system groups of which the
skipping to change at line 4404 skipping to change at line 4529
22.22 The zsh/param/private Module 22.22 The zsh/param/private Module
================================== ==================================
The zsh/param/private module is used to create parameters whose scope The zsh/param/private module is used to create parameters whose scope
is limited to the current function body, and _not_ to other functions is limited to the current function body, and _not_ to other functions
called by the current function. called by the current function.
This module provides a single autoloaded builtin: This module provides a single autoloaded builtin:
private [ {+|-}AHUahlprtux ] [ {+|-}EFLRZi [ N ] ] [ NAME[=VALUE] ... ] private [ {+|-}AHUahlmrtux ] [ {+|-}EFLRZi [ N ] ] [ NAME[=VALUE] ... ]
The private builtin accepts all the same options and arguments as The private builtin accepts all the same options and arguments as
local (*Note Shell Builtin Commands::) except for the `-T' option. local (*Note Shell Builtin Commands::) except for the `-T' option.
Tied parameters may not be made private. Tied parameters may not be made private.
The `-p' option is presently a no-op because the state of private
parameters cannot reliably be reloaded. This also applies to
printing private parameters with `typeset -p'.
If used at the top level (outside a function scope), private If used at the top level (outside a function scope), private
creates a normal parameter in the same manner as declare or creates a normal parameter in the same manner as declare or
typeset. A warning about this is printed if WARN_CREATE_GLOBAL is typeset. A warning about this is printed if WARN_CREATE_GLOBAL is
set (*Note Options::). Used inside a function scope, private set (*Note Options::). Used inside a function scope, private
creates a local parameter similar to one declared with local, creates a local parameter similar to one declared with local,
except having special properties noted below. except having special properties noted below.
Special parameters which expose or manipulate internal shell Special parameters which expose or manipulate internal shell
state, such as ARGC, argv, COLUMNS, LINES, UID, EUID, IFS, PROMPT, state, such as ARGC, argv, COLUMNS, LINES, UID, EUID, IFS, PROMPT,
RANDOM, SECONDS, etc., cannot be made private unless the `-h' RANDOM, SECONDS, etc., cannot be made private unless the `-h'
skipping to change at line 4468 skipping to change at line 4597
* The type of a parameter declared private cannot be changed in the * The type of a parameter declared private cannot be changed in the
scope where it was declared, even if the parameter is unset. Thus scope where it was declared, even if the parameter is unset. Thus
an array cannot be assigned to a private scalar, etc. an array cannot be assigned to a private scalar, etc.
* Within any other function called by the declaring function, the * Within any other function called by the declaring function, the
private parameter does _NOT_ hide other parameters of the same private parameter does _NOT_ hide other parameters of the same
name, so for example a global parameter of the same name is name, so for example a global parameter of the same name is
visible and may be assigned or unset. This includes calls to visible and may be assigned or unset. This includes calls to
anonymous functions, although that may also change in the future. anonymous functions, although that may also change in the future.
However, the private name may not be created outside the local
scope when it was not previously declared.
* An exported private remains in the environment of inner scopes but * An exported private remains in the environment of inner scopes but
appears unset for the current shell in those scopes. Generally, appears unset for the current shell in those scopes. Generally,
exporting private parameters should be avoided. exporting private parameters should be avoided.
Note that this differs from the static scope defined by compiled Note that this differs from the static scope defined by compiled
languages derived from C, in that the a new call to the same function languages derived from C, in that the a new call to the same function
creates a new scope, i.e., the parameter is still associated with the creates a new scope, i.e., the parameter is still associated with the
call stack rather than with the function definition. It differs from call stack rather than with the function definition. It differs from
ksh `typeset -S' because the syntax used to define the function has no ksh `typeset -S' because the syntax used to define the function has no
skipping to change at line 4508 skipping to change at line 4639
[[ alphabetical -regex-match ^a([^a]+)a([^a]+)a ]] && [[ alphabetical -regex-match ^a([^a]+)a([^a]+)a ]] &&
print -l $MATCH X $match print -l $MATCH X $match
If the option REMATCH_PCRE is not set, then the =~ operator will If the option REMATCH_PCRE is not set, then the =~ operator will
automatically load this module as needed and will invoke the automatically load this module as needed and will invoke the
-regex-match operator. -regex-match operator.
If BASH_REMATCH is set, then the array BASH_REMATCH will be set If BASH_REMATCH is set, then the array BASH_REMATCH will be set
instead of MATCH and match. instead of MATCH and match.
Note that the zsh/regex module logic relies on the host system. The
same EXPR and REGEX pair could produce different results on
different platforms if a REGEX with non-standard syntax is given.
For example, no syntax for matching a word boundary is defined in
the POSIX extended regular expression standard. GNU libc and BSD
libc both provide such syntaxes as extensions (\b and
[[:<:]]/[[:>:]] respectively), but neither of these syntaxes is
supported by both of these implementations.
Refer to the regcomp(3) and re_format(7) manual pages on your
system for locally-supported syntax.
 
File: zsh.info, Node: The zsh/sched Module, Next: The zsh/net/socket Module, Prev: The zsh/regex Module, Up: Zsh Modules File: zsh.info, Node: The zsh/sched Module, Next: The zsh/net/socket Module, Prev: The zsh/regex Module, Up: Zsh Modules
22.24 The zsh/sched Module 22.24 The zsh/sched Module
========================== ==========================
The zsh/sched module makes available one builtin command and one The zsh/sched module makes available one builtin command and one
parameter. parameter.
sched [-o] [+]HH:MM[:SS] COMMAND ... sched [-o] [+]HH:MM[:SS] COMMAND ...
skipping to change at line 4641 skipping to change at line 4785
22.26 The zsh/stat Module 22.26 The zsh/stat Module
========================= =========================
The zsh/stat module makes available one builtin command under two The zsh/stat module makes available one builtin command under two
possible names: possible names:
zstat [ -gnNolLtTrs ] [ -f FD ] [ -H HASH ] [ -A ARRAY ] [ -F FMT ] zstat [ -gnNolLtTrs ] [ -f FD ] [ -H HASH ] [ -A ARRAY ] [ -F FMT ]
[ +ELEMENT ] [ FILE ... ] [ +ELEMENT ] [ FILE ... ]
stat ... stat ...
The command acts as a front end to the stat system call (see man The command acts as a front end to the stat system call (see
page stat(2)). The same command is provided with two names; as stat(2)). The same command is provided with two names; as the
the name stat is often used by an external command it is name stat is often used by an external command it is recommended
recommended that only the zstat form of the command is used. This that only the zstat form of the command is used. This can be
can be arranged by loading the module with the command `zmodload arranged by loading the module with the command `zmodload -F
-F zsh/stat b:zstat'. zsh/stat b:zstat'.
If the stat call fails, the appropriate system error message If the stat call fails, the appropriate system error message
printed and status 1 is returned. The fields of struct stat give printed and status 1 is returned. The fields of struct stat give
information about the files provided as arguments to the command. information about the files provided as arguments to the command.
In addition to those available from the stat call, an extra In addition to those available from the stat call, an extra
element `link' is provided. These elements are: element `link' is provided. These elements are:
device device
The number of the device on which the file resides. The number of the device on which the file resides.
skipping to change at line 4737 skipping to change at line 4881
Similar to -A, but instead assign the values to HASH. The Similar to -A, but instead assign the values to HASH. The
keys are the elements listed above. If the -n option is keys are the elements listed above. If the -n option is
provided then the name of the file is included in the hash provided then the name of the file is included in the hash
with key name. with key name.
-f FD -f FD
Use the file on file descriptor FD instead of named files; no Use the file on file descriptor FD instead of named files; no
list of file names is allowed in this case. list of file names is allowed in this case.
-F FMT -F FMT
Supplies a strftime (see man page strftime(3)) string for the Supplies a strftime (see strftime(3)) string for the
formatting of the time elements. The format string supports formatting of the time elements. The format string supports
all of the zsh extensions described in *Note Prompt all of the zsh extensions described in *Note Prompt
Expansion::. The -s option is implied. Expansion::. In particular, -F %s.%N can be used to show
timestamps with nanosecond precision if supported by the
system. The -s option is implied.
-g -g
Show the time elements in the GMT time zone. The -s option Show the time elements in the GMT time zone. The -s option
is implied. is implied.
-l -l
List the names of the type elements (to standard output or an List the names of the type elements (to standard output or an
array as appropriate) and return immediately; arguments, and array as appropriate) and return immediately; arguments, and
options other than -A, are ignored. options other than -A, are ignored.
-L -L
Perform an lstat (see man page lstat(2)) rather than a stat Perform an lstat (see lstat(2)) rather than a stat system
system call. In this case, if the file is a link, information call. In this case, if the file is a link, information about
about the link itself rather than the target file is returned. the link itself rather than the target file is returned.
This option is required to make the link element useful. This option is required to make the link element useful.
It's important to note that this is the exact opposite from It's important to note that this is the exact opposite from
man page ls(1), etc. ls(1), etc.
-n -n
Always show the names of files. Usually these are only shown Always show the names of files. Usually these are only shown
when output is to standard output and there is more than one when output is to standard output and there is more than one
file in the list. file in the list.
-N -N
Never show the names of files. Never show the names of files.
-o -o
skipping to change at line 4858 skipping to change at line 5004
excl excl
create file, error if it already exists create file, error if it already exists
noatime noatime
suppress updating of the file atime suppress updating of the file atime
nofollow nofollow
fail if FILE is a symbolic link fail if FILE is a symbolic link
nonblock
the file is opened in nonblocking mode
sync sync
request that writes wait until data has been physically request that writes wait until data has been physically
written written
truncate truncate
trunc trunc
truncate file to size 0 truncate file to size 0
To close the file, use one of the following: To close the file, use one of the following:
skipping to change at line 4959 skipping to change at line 5108
retrying; otherwise an error causes the command to return. For retrying; otherwise an error causes the command to return. For
example, if the file descriptor is set to non-blocking output, an example, if the file descriptor is set to non-blocking output, an
error EAGAIN (on some systems, EWOULDBLOCK) may result in the error EAGAIN (on some systems, EWOULDBLOCK) may result in the
command returning early. command returning early.
The return status may be 0 for success, 1 for an error in the The return status may be 0 for success, 1 for an error in the
parameters to the command, or 2 for an error on the write; no parameters to the command, or 2 for an error on the write; no
error message is printed in the last case, but the parameter ERRNO error message is printed in the last case, but the parameter ERRNO
will reflect the error that occurred. will reflect the error that occurred.
zsystem flock [ -t TIMEOUT ] [ -f VAR ] [-er] FILE zsystem flock [ -t TIMEOUT ] [ -i INTERVAL ] [ -f VAR ] [-er] FILE
zsystem flock -u FD_EXPR zsystem flock -u FD_EXPR
The builtin zsystem's subcommand flock performs advisory file The builtin zsystem's subcommand flock performs advisory file
locking (via the man page fcntl(2) system call) over the entire locking (via the fcntl(2) system call) over the entire contents of
contents of the given file. This form of locking requires the the given file. This form of locking requires the processes
processes accessing the file to cooperate; its most obvious use is accessing the file to cooperate; its most obvious use is between
between two instances of the shell itself. two instances of the shell itself.
In the first form the named FILE, which must already exist, is In the first form the named FILE, which must already exist, is
locked by opening a file descriptor to the file and applying a locked by opening a file descriptor to the file and applying a
lock to the file descriptor. The lock terminates when the shell lock to the file descriptor. The lock terminates when the shell
process that created the lock exits; it is therefore often process that created the lock exits; it is therefore often
convenient to create file locks within subshells, since the lock convenient to create file locks within subshells, since the lock
is automatically released when the subshell exits. Note that use is automatically released when the subshell exits. Note that use
of the print builtin with the -u option will, as a side effect, of the print builtin with the -u option will, as a side effect,
release the lock, as will redirection to the file in the shell release the lock, as will redirection to the file in the shell
holding the lock. To work around this use a subshell, e.g. holding the lock. To work around this use a subshell, e.g.
skipping to change at line 4990 skipping to change at line 5139
expression FD_EXPR is closed, releasing a lock. The file expression FD_EXPR is closed, releasing a lock. The file
descriptor can be queried by using the `-f VAR' form during the descriptor can be queried by using the `-f VAR' form during the
lock; on a successful lock, the shell variable VAR is set to the lock; on a successful lock, the shell variable VAR is set to the
file descriptor used for locking. The lock will be released if the file descriptor used for locking. The lock will be released if the
file descriptor is closed by any other means, for example using file descriptor is closed by any other means, for example using
`exec {VAR}>&-'; however, the form described here performs a `exec {VAR}>&-'; however, the form described here performs a
safety check that the file descriptor is in use for file locking. safety check that the file descriptor is in use for file locking.
By default the shell waits indefinitely for the lock to succeed. By default the shell waits indefinitely for the lock to succeed.
The option -t TIMEOUT specifies a timeout for the lock in seconds; The option -t TIMEOUT specifies a timeout for the lock in seconds;
currently this must be an integer. The shell will attempt to lock fractional seconds are allowed. During this period, the shell
the file once a second during this period. If the attempt times will attempt to lock the file every INTERVAL seconds if the -i
out, status 2 is returned. INTERVAL option is given, otherwise once a second. (This INTERVAL
is shortened before the last attempt if needed, so that the shell
waits only until the TIMEOUT and not longer.) If the attempt
times out, status 2 is returned.
(Note: TIMEOUT is limited to 2^30-1 seconds (about 34 years), and
INTERVAL to 0.999 * LONG_MAX microseconds (only about 35 minutes
on 32-bit systems).)
If the option -e is given, the file descriptor for the lock is If the option -e is given, the file descriptor for the lock is
preserved when the shell uses exec to start a new process; preserved when the shell uses exec to start a new process;
otherwise it is closed at that point and the lock released. otherwise it is closed at that point and the lock released.
If the option -r is given, the lock is only for reading, otherwise If the option -r is given, the lock is only for reading, otherwise
it is for reading and writing. The file descriptor is opened it is for reading and writing. The file descriptor is opened
accordingly. accordingly.
zsystem supports SUBCOMMAND zsystem supports SUBCOMMAND
skipping to change at line 5042 skipping to change at line 5198
sysparams sysparams
A readonly associative array. The keys are: A readonly associative array. The keys are:
pid pid
Returns the process ID of the current process, even in Returns the process ID of the current process, even in
subshells. Compare $$, which returns the process ID of the subshells. Compare $$, which returns the process ID of the
main shell process. main shell process.
ppid ppid
Returns the process ID of the parent of the current process, Returns the current process ID of the parent of the current
even in subshells. Compare $PPID, which returns the process process, even in subshells. Compare $PPID, which returns the
ID of the parent of the main shell process. process ID of the initial parent of the main shell process.
procsubstpid procsubstpid
Returns the process ID of the last process started for process Returns the process ID of the last process started for process
substitution, i.e. the <(...) and >(...) expansions. substitution, i.e. the <(...) and >(...) expansions.
 
File: zsh.info, Node: The zsh/net/tcp Module, Next: The zsh/termcap Module, P rev: The zsh/system Module, Up: Zsh Modules File: zsh.info, Node: The zsh/net/tcp Module, Next: The zsh/termcap Module, P rev: The zsh/system Module, Up: Zsh Modules
22.28 The zsh/net/tcp Module 22.28 The zsh/net/tcp Module
============================ ============================
skipping to change at line 5217 skipping to change at line 5373
Output the termcap value corresponding to the capability CAP, with Output the termcap value corresponding to the capability CAP, with
optional arguments. optional arguments.
The zsh/termcap module makes available one parameter: The zsh/termcap module makes available one parameter:
termcap termcap
An associative array that maps termcap capability codes to their An associative array that maps termcap capability codes to their
values. values.
 
File: zsh.info, Node: The zsh/terminfo Module, Next: The zsh/zftp Module, Pre v: The zsh/termcap Module, Up: Zsh Modules File: zsh.info, Node: The zsh/terminfo Module, Next: The zsh/watch Module, Pr ev: The zsh/termcap Module, Up: Zsh Modules
22.30 The zsh/terminfo Module 22.30 The zsh/terminfo Module
============================= =============================
The zsh/terminfo module makes available one builtin command: The zsh/terminfo module makes available one builtin command:
echoti CAP [ ARG ] echoti CAP [ ARG ]
Output the terminfo value corresponding to the capability CAP, Output the terminfo value corresponding to the capability CAP,
instantiated with ARG if applicable. instantiated with ARG if applicable.
The zsh/terminfo module makes available one parameter: The zsh/terminfo module makes available one parameter:
terminfo terminfo
An associative array that maps terminfo capability names to their An associative array that maps terminfo capability names to their
values. values.
 
File: zsh.info, Node: The zsh/zftp Module, Next: The zsh/zle Module, Prev: Th File: zsh.info, Node: The zsh/watch Module, Next: The zsh/zftp Module, Prev:
e zsh/terminfo Module, Up: Zsh Modules The zsh/terminfo Module, Up: Zsh Modules
22.31 The zsh/watch Module
==========================
The zsh/watch module can be used to report when specific users log
in or out. This is controlled via the following parameters.
LOGCHECK
The interval in seconds between checks for login/logout activity
using the watch parameter.
watch <S> <Z> (WATCH <S>)
An array (colon-separated list) of login/logout events to report.
If it contains the single word `all', then all login/logout events
are reported. If it contains the single word `notme', then all
events are reported as with `all' except $USERNAME.
An entry in this list may consist of a username, an `@' followed
by a remote hostname, and a `%' followed by a line (tty). Any of
these may be a pattern (be sure to quote this during the
assignment to watch so that it does not immediately perform file
generation); the setting of the EXTENDED_GLOB option is respected.
Any or all of these components may be present in an entry; if a
login/logout event matches all of them, it is reported.
For example, with the EXTENDED_GLOB option set, the following:
watch=('^(pws|barts)')
causes reports for activity associated with any user other than pws
or barts.
WATCHFMT
The format of login/logout reports if the watch parameter is set.
Default is `%n has %a %l from %m'. Recognizes the following
escape sequences:
%n
The name of the user that logged in/out.
%a
The observed action, i.e. "logged on" or "logged off".
%l
The line (tty) the user is logged in on.
%M
The full hostname of the remote host.
%m
The hostname up to the first `.'. If only the IP address is
available or the utmp field contains the name of an X-windows
display, the whole name is printed.
_NOTE:_ The `%m' and `%M' escapes will work only if there is
a host name field in the utmp on your machine. Otherwise
they are treated as ordinary strings.
%F{COLOR} (%f)
Start (stop) using a different foreground color.
%K{COLOR} (%k)
Start (stop) using a different background color.
%S (%s)
Start (stop) standout mode.
%U (%u)
Start (stop) underline mode.
%B (%b)
Start (stop) boldface mode.
%t
%@
The time, in 12-hour, am/pm format.
%T
The time, in 24-hour format.
%w
The date in `DAY-DD' format.
%W
The date in `MM/DD/YY' format.
%D
The date in `YY-MM-DD' format.
%D{STRING}
The date formatted as STRING using the strftime function, with
zsh extensions as described by *Note Prompt Expansion::.
%(X:TRUE-TEXT:FALSE-TEXT)
Specifies a ternary expression. The character following the
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.
The test character X may be any one of `l', `n', `m' or `M',
which indicate a `true' result if the corresponding escape
sequence would return a non-empty value; or it may be `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.
If the result is `true', then the TRUE-TEXT is formatted
according to the rules above and printed, and the FALSE-TEXT
is skipped. If `false', the TRUE-TEXT is skipped and the
FALSE-TEXT is formatted and printed. Either or both of the
branches may be empty, but both separators must be present in
any case.
Furthermore, the zsh/watch module makes available one builtin command:
log
List all users currently logged in who are affected by the current
setting of the watch parameter.

File: zsh.info, Node: The zsh/zftp Module, Next: The zsh/zle Module, Prev: Th
e zsh/watch Module, Up: Zsh Modules
22.31 The zsh/zftp Module 22.32 The zsh/zftp Module
========================= =========================
The zsh/zftp module makes available one builtin command: The zsh/zftp module makes available one builtin command:
zftp SUBCOMMAND [ ARGS ] zftp SUBCOMMAND [ ARGS ]
The zsh/zftp module is a client for FTP (file transfer protocol). The zsh/zftp module is a client for FTP (file transfer protocol).
It is implemented as a builtin to allow full use of shell command It is implemented as a builtin to allow full use of shell command
line editing, file I/O, and job control mechanisms. Often, users line editing, file I/O, and job control mechanisms. Often, users
will access it via shell functions providing a more powerful will access it via shell functions providing a more powerful
interface; a set is provided with the zsh distribution and is interface; a set is provided with the zsh distribution and is
described in *Note Zftp Function System::. However, the zftp described in *Note Zftp Function System::. However, the zftp
command is entirely usable in its own right. command is entirely usable in its own right.
All commands consist of the command name zftp followed by the name All commands consist of the command name zftp followed by the name
of a subcommand. These are listed below. The return status of of a subcommand. These are listed below. The return status of
each subcommand is supposed to reflect the success or failure of each subcommand is supposed to reflect the success or failure of
the remote operation. See a description of the variable the remote operation. See a description of the variable
ZFTP_VERBOSE for more information on how responses from the server ZFTP_VERBOSE for more information on how responses from the server
may be printed. may be printed.
22.31.1 Subcommands 22.32.1 Subcommands
------------------- -------------------
open HOST[:PORT] [ USER [ PASSWORD [ ACCOUNT ] ] ] open HOST[:PORT] [ USER [ PASSWORD [ ACCOUNT ] ] ]
Open a new FTP session to HOST, which may be the name of a TCP/IP Open a new FTP session to HOST, which may be the name of a TCP/IP
connected host or an IP number in the standard dot notation. If connected host or an IP number in the standard dot notation. If
the argument is in the form HOST:PORT, open a connection to TCP the argument is in the form HOST:PORT, open a connection to TCP
port PORT instead of the standard FTP port 21. This may be the port PORT instead of the standard FTP port 21. This may be the
name of a TCP service or a number: see the description of name of a TCP service or a number: see the description of
ZFTP_PORT below for more information. ZFTP_PORT below for more information.
skipping to change at line 5496 skipping to change at line 5776
Delete a session; if a name is not given, the current session is Delete a session; if a name is not given, the current session is
deleted. If the current session is deleted, the earliest existing deleted. If the current session is deleted, the earliest existing
session becomes the new current session, otherwise the current session becomes the new current session, otherwise the current
session is not changed. If the session being deleted is the only session is not changed. If the session being deleted is the only
one, a new session called `default' is created and becomes the one, a new session called `default' is created and becomes the
current session; note that this is a new session even if the current session; note that this is a new session even if the
session being deleted is also called `default'. It is recommended session being deleted is also called `default'. It is recommended
that sessions not be deleted while background commands which use that sessions not be deleted while background commands which use
zftp are still active. zftp are still active.
22.31.2 Parameters 22.32.2 Parameters
------------------ ------------------
The following shell parameters are used by zftp. Currently none of The following shell parameters are used by zftp. Currently none of
them are special. them are special.
ZFTP_TMOUT ZFTP_TMOUT
Integer. The time in seconds to wait for a network operation to Integer. The time in seconds to wait for a network operation to
complete before returning an error. If this is not set when the complete before returning an error. If this is not set when the
module is loaded, it will be given the default value 60. A value module is loaded, it will be given the default value 60. A value
of zero turns off timeouts. If a timeout occurs on the control of zero turns off timeouts. If a timeout occurs on the control
skipping to change at line 5632 skipping to change at line 5912
error in a processed format. By convention, servers use this error in a processed format. By convention, servers use this
mechanism for sending information for the user to read. The mechanism for sending information for the user to read. The
appropriate reply code, if it matches the same response, takes appropriate reply code, if it matches the same response, takes
priority. priority.
If ZFTP_VERBOSE is not set when zftp is loaded, it will be set to If ZFTP_VERBOSE is not set when zftp is loaded, it will be set to
the default value 450, i.e., messages destined for the user and the default value 450, i.e., messages destined for the user and
all errors will be printed. A null string is valid and specifies all errors will be printed. A null string is valid and specifies
that no messages should be printed. that no messages should be printed.
22.31.3 Functions 22.32.3 Functions
----------------- -----------------
zftp_chpwd zftp_chpwd
If this function is set by the user, it is called every time the If this function is set by the user, it is called every time the
directory changes on the server, including when a user is logged directory changes on the server, including when a user is logged
in, or when a connection is closed. In the last case, $ZFTP_PWD in, or when a connection is closed. In the last case, $ZFTP_PWD
will be unset; otherwise it will reflect the new directory. will be unset; otherwise it will reflect the new directory.
zftp_progress zftp_progress
If this function is set by the user, it will be called during a If this function is set by the user, it will be called during a
skipping to change at line 5681 skipping to change at line 5961
The function is initially called with ZFTP_TRANSFER set The function is initially called with ZFTP_TRANSFER set
appropriately and ZFTP_COUNT set to zero. After the transfer is appropriately and ZFTP_COUNT set to zero. After the transfer is
finished, the function will be called one more time with finished, the function will be called one more time with
ZFTP_TRANSFER set to GF or PF, in case it wishes to tidy up. It ZFTP_TRANSFER set to GF or PF, in case it wishes to tidy up. It
is otherwise never called twice with the same value of ZFTP_COUNT. is otherwise never called twice with the same value of ZFTP_COUNT.
Sometimes the progress meter may cause disruption. It is up to the Sometimes the progress meter may cause disruption. It is up to the
user to decide whether the function should be defined and to use user to decide whether the function should be defined and to use
unfunction when necessary. unfunction when necessary.
22.31.4 Problems 22.32.4 Problems
---------------- ----------------
A connection may not be opened in the left hand side of a pipe as this A connection may not be opened in the left hand side of a pipe as this
occurs in a subshell and the file information is not updated in the main occurs in a subshell and the file information is not updated in the main
shell. In the case of type or mode changes or closing the connection shell. In the case of type or mode changes or closing the connection
in a subshell, the information is returned but variables are not in a subshell, the information is returned but variables are not
updated until the next call to zftp. Other status changes in subshells updated until the next call to zftp. Other status changes in subshells
will not be reflected by changes to the variables (but should be will not be reflected by changes to the variables (but should be
otherwise harmless). otherwise harmless).
skipping to change at line 5706 skipping to change at line 5986
ordering of that information. ordering of that information.
On some operating systems, the control connection is not valid after a On some operating systems, the control connection is not valid after a
fork(), so that operations in subshells, on the left hand side of a fork(), so that operations in subshells, on the left hand side of a
pipeline, or in the background are not possible, as they should be. pipeline, or in the background are not possible, as they should be.
This is presumably a bug in the operating system. This is presumably a bug in the operating system.
 
File: zsh.info, Node: The zsh/zle Module, Next: The zsh/zleparameter Module, Prev: The zsh/zftp Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zle Module, Next: The zsh/zleparameter Module, Prev: The zsh/zftp Module, Up: Zsh Modules
22.32 The zsh/zle Module 22.33 The zsh/zle Module
======================== ========================
The zsh/zle module contains the Zsh Line Editor. See *Note Zsh Line The zsh/zle module contains the Zsh Line Editor. See *Note Zsh Line
Editor::. Editor::.
 
File: zsh.info, Node: The zsh/zleparameter Module, Next: The zsh/zprof Module, Prev: The zsh/zle Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zleparameter Module, Next: The zsh/zprof Module, Prev: The zsh/zle Module, Up: Zsh Modules
22.33 The zsh/zleparameter Module 22.34 The zsh/zleparameter Module
================================= =================================
The zsh/zleparameter module defines two special parameters that can The zsh/zleparameter module defines two special parameters that can
be used to access internal information of the Zsh Line Editor (see be used to access internal information of the Zsh Line Editor (see
*Note Zsh Line Editor::). *Note Zsh Line Editor::).
keymaps keymaps
This array contains the names of the keymaps currently defined. This array contains the names of the keymaps currently defined.
widgets widgets
skipping to change at line 5741 skipping to change at line 6021
widget, a string of the form `completion:TYPE:NAME' for widget, a string of the form `completion:TYPE:NAME' for
completion widgets, or a null value if the widget is not yet completion widgets, or a null value if the widget is not yet
fully defined. In the penultimate case, TYPE is the name of the fully defined. In the penultimate case, TYPE is the name of the
builtin widget the completion widget imitates in its behavior and builtin widget the completion widget imitates in its behavior and
NAME is the name of the shell function implementing the completion NAME is the name of the shell function implementing the completion
widget. widget.
 
File: zsh.info, Node: The zsh/zprof Module, Next: The zsh/zpty Module, Prev: The zsh/zleparameter Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zprof Module, Next: The zsh/zpty Module, Prev: The zsh/zleparameter Module, Up: Zsh Modules
22.34 The zsh/zprof Module 22.35 The zsh/zprof Module
========================== ==========================
When loaded, the zsh/zprof causes shell functions to be profiled. When loaded, the zsh/zprof causes shell functions to be profiled.
The profiling results can be obtained with the zprof builtin command The profiling results can be obtained with the zprof builtin command
made available by this module. There is no way to turn profiling off made available by this module. There is no way to turn profiling off
other than unloading the module. other than unloading the module.
zprof [ -c ] zprof [ -c ]
Without the -c option, zprof lists profiling results to standard Without the -c option, zprof lists profiling results to standard
output. The format is comparable to that of commands like gprof. output. The format is comparable to that of commands like gprof.
skipping to change at line 5801 skipping to change at line 6081
As long as the zsh/zprof module is loaded, profiling will be done As long as the zsh/zprof module is loaded, profiling will be done
and multiple invocations of the zprof builtin command will show the and multiple invocations of the zprof builtin command will show the
times and numbers of calls since the module was loaded. With the times and numbers of calls since the module was loaded. With the
-c option, the zprof builtin command will reset its internal -c option, the zprof builtin command will reset its internal
counters and will not show the listing. counters and will not show the listing.
 
File: zsh.info, Node: The zsh/zpty Module, Next: The zsh/zselect Module, Prev : The zsh/zprof Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zpty Module, Next: The zsh/zselect Module, Prev : The zsh/zprof Module, Up: Zsh Modules
22.35 The zsh/zpty Module 22.36 The zsh/zpty Module
========================= =========================
The zsh/zpty module offers one builtin: The zsh/zpty module offers one builtin:
zpty [ -e ] [ -b ] NAME [ ARG ... ] zpty [ -e ] [ -b ] NAME [ ARG ... ]
The arguments following NAME are concatenated with spaces between, The arguments following NAME are concatenated with spaces between,
then executed as a command, as if passed to the eval builtin. The then executed as a command, as if passed to the eval builtin. The
command runs under a newly assigned pseudo-terminal; this is command runs under a newly assigned pseudo-terminal; this is
useful for running commands non-interactively which expect an useful for running commands non-interactively which expect an
interactive environment. The NAME is not part of the command, but interactive environment. The NAME is not part of the command, but
skipping to change at line 5895 skipping to change at line 6175
the command is running and a non-zero value otherwise. the command is running and a non-zero value otherwise.
zpty [ -L ] zpty [ -L ]
The last form, without any arguments, is used to list the commands The last form, without any arguments, is used to list the commands
currently defined. If the -L option is given, this is done in the currently defined. If the -L option is given, this is done in the
form of calls to the zpty builtin. form of calls to the zpty builtin.
 
File: zsh.info, Node: The zsh/zselect Module, Next: The zsh/zutil Module, Pre v: The zsh/zpty Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zselect Module, Next: The zsh/zutil Module, Pre v: The zsh/zpty Module, Up: Zsh Modules
22.36 The zsh/zselect Module 22.37 The zsh/zselect Module
============================ ============================
The zsh/zselect module makes available one builtin command: The zsh/zselect module makes available one builtin command:
zselect [ -rwe ] [ -t TIMEOUT ] [ -a ARRAY ] [ -A ASSOC ] [ FD ... ] zselect [ -rwe ] [ -t TIMEOUT ] [ -a ARRAY ] [ -A ASSOC ] [ FD ... ]
The zselect builtin is a front-end to the `select' system call, The zselect builtin is a front-end to the `select' system call,
which blocks until a file descriptor is ready for reading or which blocks until a file descriptor is ready for reading or
writing, or has an error condition, with an optional timeout. If writing, or has an error condition, with an optional timeout. If
this is not available on your system, the command prints an error this is not available on your system, the command prints an error
message and returns status 2 (normal errors return status 1). For message and returns status 2 (normal errors return status 1). For
more information, see your systems documentation for man page more information, see your system's documentation for select(3).
select(3). Note there is no connection with the shell builtin of Note there is no connection with the shell builtin of the same
the same name. name.
Arguments and options may be intermingled in any order. Non-option Arguments and options may be intermingled in any order. Non-option
arguments are file descriptors, which must be decimal integers. By arguments are file descriptors, which must be decimal integers. By
default, file descriptors are to be tested for reading, i.e. default, file descriptors are to be tested for reading, i.e.
zselect will return when data is available to be read from the zselect will return when data is available to be read from the
file descriptor, or more precisely, when a read operation from the file descriptor, or more precisely, when a read operation from the
file descriptor will not block. After a -r, -w and -e, the given file descriptor will not block. After a -r, -w and -e, the given
file descriptors are to be tested for reading, writing, or error file descriptors are to be tested for reading, writing, or error
conditions. These options and an arbitrary list of file conditions. These options and an arbitrary list of file
descriptors may be given in any order. descriptors may be given in any order.
skipping to change at line 5962 skipping to change at line 6242
The command returns status 0 if some file descriptors are ready for The command returns status 0 if some file descriptors are ready for
reading. If the operation timed out, or a timeout of 0 was given reading. If the operation timed out, or a timeout of 0 was given
and no file descriptors were ready, or there was an error, it and no file descriptors were ready, or there was an error, it
returns status 1 and the array will not be set (nor modified in returns status 1 and the array will not be set (nor modified in
any way). If there was an error in the select operation the any way). If there was an error in the select operation the
appropriate error message is printed. appropriate error message is printed.
 
File: zsh.info, Node: The zsh/zutil Module, Prev: The zsh/zselect Module, Up: Zsh Modules File: zsh.info, Node: The zsh/zutil Module, Prev: The zsh/zselect Module, Up: Zsh Modules
22.37 The zsh/zutil Module 22.38 The zsh/zutil Module
========================== ==========================
The zsh/zutil module only adds some builtins: The zsh/zutil module only adds some builtins:
zstyle [ -L [ METAPATTERN [ STYLE ] ] ] zstyle [ -L [ METAPATTERN [ STYLE ] ] ]
zstyle [ -e | - | -- ] PATTERN STYLE STRING ... zstyle [ -e | - | -- ] PATTERN STYLE STRING ...
zstyle -d [ PATTERN [ STYLE ... ] ] zstyle -d [ PATTERN [ STYLE ... ] ]
zstyle -g NAME [ PATTERN [ STYLE ] ] zstyle -g NAME [ PATTERN [ STYLE ] ]
zstyle -{a|b|s} CONTEXT STYLE NAME [ SEP ] zstyle -{a|b|s} CONTEXT STYLE NAME [ SEP ]
zstyle -{T|t} CONTEXT STYLE [ STRING ... ] zstyle -{T|t} CONTEXT STYLE [ STRING ... ]
skipping to change at line 5993 skipping to change at line 6273
the patterns for the components are more specific, where simple the patterns for the components are more specific, where simple
strings are considered to be more specific than patterns and strings are considered to be more specific than patterns and
complex patterns are considered to be more specific than the complex patterns are considered to be more specific than the
pattern `*'. A `*' in the pattern will match zero or more pattern `*'. A `*' in the pattern will match zero or more
characters in the context; colons are not treated specially in characters in the context; colons are not treated specially in
this regard. If two patterns are equally specific, the tie is this regard. If two patterns are equally specific, the tie is
broken in favour of the pattern that was defined first. broken in favour of the pattern that was defined first.
_Example_ _Example_
For example, to define your preferred form of precipitation For example, a fictional `weather' plugin might state in its
depending on which city you're in, you might set the following in documentation that it looks up the preferred-precipitation style
your zshrc: under the `:weather:CONTINENT:DAY-OF-THE-WEEK:PHASE-OF-THE-MOON'
context. According to this, you might set the following in your
zshrc:
zstyle ':weather:europe:*' preferred-precipitation rain zstyle ':weather:europe:*' preferred-precipitation rain
zstyle ':weather:europe:germany:* preferred-precipitation none zstyle ':weather:*:Sunday:*' preferred-precipitation snow
zstyle ':weather:europe:germany:*:munich' preferred-precipitation snow
Then, the fictional `weather' plugin might run under the hood a Then the plugin would run under the hood a command such as
command such as
zstyle -s ":weather:${continent}:${country}:${county}:${city}" preferr ed-precipitation REPLY zstyle -s ":weather:${continent}:${day_of_week}:${moon_phase}" preferr ed-precipitation REPLY
in order to retrieve your preference into the scalar variable in order to retrieve your preference into the scalar variable
$REPLY. $REPLY. On Sundays $REPLY would be set to `snow'; in Europe it
would be set to `rain'; and on Sundays in Europe it would be set
to `snow' again, because the patterns `:weather:europe:*' and
`:weather:*:Sunday:*' both match the CONTEXT argument to zstyle
-s, are equally specific, and the latter is more specific (because
it has more colon-separated components).
_Usage_ _Usage_
The forms that operate on patterns are the following. The forms that operate on patterns are the following.
zstyle [ -L [ METAPATTERN [ STYLE ] ] ] zstyle [ -L [ METAPATTERN [ STYLE ] ] ]
Without arguments, lists style definitions. Styles are shown Without arguments, lists style definitions. Styles are shown
in alphabetic order and patterns are shown in the order in alphabetic order and patterns are shown in the order
zstyle will test them. zstyle will test them.
skipping to change at line 6102 skipping to change at line 6387
The -T option tests the values of the style like -t, but it The -T option tests the values of the style like -t, but it
returns status zero (rather than 2) if the style is not returns status zero (rather than 2) if the style is not
defined for any matching pattern. defined for any matching pattern.
zstyle -m CONTEXT STYLE PATTERN zstyle -m CONTEXT STYLE PATTERN
Match a value. Returns status zero if the PATTERN matches at Match a value. Returns status zero if the PATTERN matches at
least one of the strings in the value. least one of the strings in the value.
zformat -f PARAM FORMAT SPEC ... zformat -f PARAM FORMAT SPEC ...
zformat -F PARAM FORMAT SPEC ...
zformat -a ARRAY SEP SPEC ... zformat -a ARRAY SEP SPEC ...
This builtin provides two different forms of formatting. The first This builtin provides different forms of formatting. The first form
form is selected with the -f option. In this case the FORMAT is selected with the -f option. In this case the FORMAT string
string will be modified by replacing sequences starting with a will be modified by replacing sequences starting with a percent
percent sign in it with strings from the SPECs. Each SPEC should sign in it with strings from the SPECs. Each SPEC should be of
be of the form `CHAR:STRING' which will cause every appearance of the form `CHAR:STRING' which will cause every appearance of the
the sequence `%CHAR' in FORMAT to be replaced by the STRING. The sequence `%CHAR' in FORMAT to be replaced by the STRING. The `%'
`%' sequence may also contain optional minimum and maximum field sequence may also contain optional minimum and maximum field width
width specifications between the `%' and the `CHAR' in the form specifications between the `%' and the `CHAR' in the form
`%MIN.MAXc', i.e. the minimum field width is given first and if `%MIN.MAXc', i.e. the minimum field width is given first and if
the maximum field width is used, it has to be preceded by a dot. the maximum field width is used, it has to be preceded by a dot.
Specifying a minimum field width makes the result be padded with Specifying a minimum field width makes the result be padded with
spaces to the right if the STRING is shorter than the requested spaces to the right if the STRING is shorter than the requested
width. Padding to the left can be achieved by giving a negative width. Padding to the left can be achieved by giving a negative
minimum field width. If a maximum field width is specified, the minimum field width. If a maximum field width is specified, the
STRING will be truncated after that many characters. After all STRING will be truncated after that many characters. After all
`%' sequences for the given SPECs have been processed, the `%' sequences for the given SPECs have been processed, the
resulting string is stored in the parameter PARAM. resulting string is stored in the parameter PARAM.
skipping to change at line 6146 skipping to change at line 6432
%-escapes. %-escapes.
For example: For example:
zformat -f REPLY "The answer is '%3(c.yes.no)'." c:3 zformat -f REPLY "The answer is '%3(c.yes.no)'." c:3
outputs "The answer is 'yes'." to REPLY since the value for the outputs "The answer is 'yes'." to REPLY since the value for the
format specifier c is 3, agreeing with the digit argument to the format specifier c is 3, agreeing with the digit argument to the
ternary expression. ternary expression.
The second form, using the -a option, can be used for aligning With -F instead of -f, ternary expressions choose between the
strings. Here, the SPECs are of the form `LEFT:RIGHT' where `true' or `false' text on the basis of whether the format
`LEFT' and `RIGHT' are arbitrary strings. These strings are specifier is present and non-empty. A test number indicates a
modified by replacing the colons by the SEP string and padding the minimum width for the value given in the format specifier.
LEFT strings with spaces to the right so that the SEP strings in Negative numbers reverse this, so the test is for whether the
the result (and hence the RIGHT strings after them) are all value exceeds a maximum width.
aligned if the strings are printed below each other. All strings
without a colon are left unchanged and all strings with an empty The form, using the -a option, can be used for aligning strings.
RIGHT string have the trailing colon removed. In both cases the Here, the SPECs are of the form `LEFT:RIGHT' where `LEFT' and
lengths of the strings are not used to determine how the other `RIGHT' are arbitrary strings. These strings are modified by
strings are to be aligned. A colon in the LEFT string can be replacing the colons by the SEP string and padding the LEFT
escaped with a backslash. The resulting strings are stored in the strings with spaces to the right so that the SEP strings in the
ARRAY. result (and hence the RIGHT strings after them) are all aligned if
the strings are printed below each other. All strings without a
colon are left unchanged and all strings with an empty RIGHT
string have the trailing colon removed. In both cases the lengths
of the strings are not used to determine how the other strings are
to be aligned. A colon in the LEFT string can be escaped with a
backslash. The resulting strings are stored in the ARRAY.
zregexparse zregexparse
This implements some internals of the _regex_arguments function. This implements some internals of the _regex_arguments function.
zparseopts [ -D -E -F -K -M ] [ -a ARRAY ] [ -A ASSOC ] [ - ] SPEC ... zparseopts [ -D -E -F -K -M ] [ -a ARRAY ] [ -A ASSOC ] [ - ] SPEC ...
This builtin simplifies the parsing of options in positional This builtin simplifies the parsing of options in positional
parameters, i.e. the set of arguments given by $*. Each SPEC parameters, i.e. the set of arguments given by $*. Each SPEC
describes one option and must be of the form `OPT[=ARRAY]'. If an describes one option and must be of the form `OPT[=ARRAY]'. If an
option described by OPT is found in the positional parameters it option described by OPT is found in the positional parameters it
is copied into the ARRAY specified with the -a option; if the is copied into the ARRAY specified with the -a option; if the
 End of changes. 59 change blocks. 
101 lines changed or deleted 394 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)