1ZSHBUILTINS(1) General Commands Manual ZSHBUILTINS(1)
2
3
4
6 zshbuiltins - zsh built-in commands
7
9 - simple command
10 See the section `Precommand Modifiers'.
11
12 . file [ arg ... ]
13 Read commands from file and execute them in the current shell
14 environment.
15
16 If file does not contain a slash, or if PATH_DIRS is set, the
17 shell looks in the components of $path to find the directory
18 containing file. Files in the current directory are not read
19 unless `.' appears somewhere in $path. If a file named
20 `file.zwc' is found, is newer than file, and is the compiled
21 form (created with the zcompile builtin) of file, then commands
22 are read from that file instead of file.
23
24 If any arguments arg are given, they become the positional
25 parameters; the old positional parameters are restored when the
26 file is done executing. The exit status is the exit status of
27 the last command executed.
28
29 : [ arg ... ]
30 This command does nothing, although normal argument expansions
31 is performed which may have effects on shell parameters. A zero
32 exit code is returned.
33
34 alias [ {+|-}gmrsL ] [ name[=value] ... ]
35 For each name with a corresponding value, define an alias with
36 that value. A trailing space in value causes the next word to
37 be checked for alias expansion. If the -g flag is present,
38 define a global alias; global aliases are expanded even if they
39 do not occur in command position.
40
41 If the -s flags is present, define a suffix alias: if the com‐
42 mand word on a command line is in the form `text.name', where
43 text is any non-empty string, it is replaced by the text `value
44 text.name'. Note that name is treated as a literal string, not
45 a pattern. A trailing space in value is not special in this
46 case. For example,
47
48 alias -s ps=gv
49
50 will cause the command `*.ps' to be expanded to `gv *.ps'. As
51 alias expansion is carried out earlier than globbing, the `*.ps'
52 will then be expanded. Suffix aliases constitute a different
53 name space from other aliases (so in the above example it is
54 still possible to create an alias for the command ps) and the
55 two sets are never listed together.
56
57 For each name with no value, print the value of name, if any.
58 With no arguments, print all currently defined aliases other
59 than suffix aliases. If the -m flag is given the arguments are
60 taken as patterns (they should be quoted to preserve them from
61 being interpreted as glob patterns), and the aliases matching
62 these patterns are printed. When printing aliases and one of
63 the -g, -r or -s flags is present, restrict the printing to
64 global, regular or suffix aliases, respectively; a regular alias
65 is one which is neither a global nor a suffix alias. Using `+'
66 instead of `-', or ending the option list with a single `+',
67 prevents the values of the aliases from being printed.
68
69 If the -L flag is present, then print each alias in a manner
70 suitable for putting in a startup script. The exit status is
71 nonzero if a name (with no value) is given for which no alias
72 has been defined.
73
74 autoload [ {+|-}UXktz ] [ -w ] [ name ... ]
75 Equivalent to functions -u, with the exception of -X/+X and -w.
76
77 The flag -X may be used only inside a shell function, and may
78 not be followed by a name. It causes the calling function to be
79 marked for autoloading and then immediately loaded and executed,
80 with the current array of positional parameters as arguments.
81 This replaces the previous definition of the function. If no
82 function definition is found, an error is printed and the func‐
83 tion remains undefined and marked for autoloading.
84
85 The flag +X attempts to load each name as an autoloaded func‐
86 tion, but does not execute it. The exit status is zero (suc‐
87 cess) if the function was not previously defined and a defini‐
88 tion for it was found. This does not replace any existing defi‐
89 nition of the function. The exit status is nonzero (failure) if
90 the function was already defined or when no definition was
91 found. In the latter case the function remains undefined and
92 marked for autoloading. If ksh-style autoloading is enabled,
93 the function created will contain the contents of the file plus
94 a call to the function itself appended to it, thus giving normal
95 ksh autoloading behaviour on the first call to the function.
96
97 With the -w flag, the names are taken as names of files compiled
98 with the zcompile builtin, and all functions defined in them are
99 marked for autoloading.
100
101 bg [ job ... ]
102 job ... &
103 Put each specified job in the background, or the current job if
104 none is specified.
105
106 bindkey
107 See the section `Zle Builtins' in zshzle(1).
108
109 break [ n ]
110 Exit from an enclosing for, while, until, select or repeat loop.
111 If n is specified, then break n levels instead of just one.
112
113 builtin name [ args ... ]
114 Executes the builtin name, with the given args.
115
116 bye Same as exit.
117
118 cap See the section `The zsh/cap Module' in zshmodules(1).
119
120 cd [ -sLP ] [ arg ]
121 cd [ -sLP ] old new
122 cd [ -sLP ] {+|-}n
123 Change the current directory. In the first form, change the
124 current directory to arg, or to the value of $HOME if arg is not
125 specified. If arg is `-', change to the value of $OLDPWD, the
126 previous directory. Otherwise, if a directory named arg is not
127 found in the current directory and arg does not begin with a
128 slash, search each component of the shell parameter cdpath. If
129 no directory is found and the option CDABLE_VARS is set, and a
130 parameter named arg exists whose value begins with a slash,
131 treat its value as the directory. In that case, the parameter
132 is added to the named directory hash table.
133
134 The second form of cd substitutes the string new for the string
135 old in the name of the current directory, and tries to change to
136 this new directory.
137
138 The third form of cd extracts an entry from the directory stack,
139 and changes to that directory. An argument of the form `+n'
140 identifies a stack entry by counting from the left of the list
141 shown by the dirs command, starting with zero. An argument of
142 the form `-n' counts from the right. If the PUSHD_MINUS option
143 is set, the meanings of `+' and `-' in this context are swapped.
144
145 If the -s option is specified, cd refuses to change the current
146 directory if the given pathname contains symlinks. If the -P
147 option is given or the CHASE_LINKS option is set, symbolic links
148 are resolved to their true values. If the -L option is given
149 symbolic links are followed regardless of the state of the
150 CHASE_LINKS option.
151
152 chdir Same as cd.
153
154 clone See the section `The zsh/clone Module' in zshmodules(1).
155
156 command [ -pvV ] simple command
157 The simple command argument is taken as an external command
158 instead of a function or builtin and is executed. If the
159 POSIX_BUILTINS option is set, builtins will also be executed but
160 certain special properties of them are suppressed. The -p flag
161 causes a default path to be searched instead of that in $path.
162 With the -v flag, command is similar to whence and with -V, it
163 is equivalent to whence -v.
164
165 See also the section `Precommand Modifiers'.
166
167 comparguments
168 See the section `The zsh/computil Module' in zshmodules(1).
169
170 compcall
171 See the section `The zsh/compctl Module' in zshmodules(1).
172
173 compctl
174 See the section `The zsh/compctl Module' in zshmodules(1).
175
176 compdescribe
177 See the section `The zsh/computil Module' in zshmodules(1).
178
179 compfiles
180 See the section `The zsh/computil Module' in zshmodules(1).
181
182 compgroups
183 See the section `The zsh/computil Module' in zshmodules(1).
184
185 compquote
186 See the section `The zsh/computil Module' in zshmodules(1).
187
188 comptags
189 See the section `The zsh/computil Module' in zshmodules(1).
190
191 comptry
192 See the section `The zsh/computil Module' in zshmodules(1).
193
194 compvalues
195 See the section `The zsh/computil Module' in zshmodules(1).
196
197 continue [ n ]
198 Resume the next iteration of the enclosing for, while, until,
199 select or repeat loop. If n is specified, break out of n-1
200 loops and resume at the nth enclosing loop.
201
202 declare
203 Same as typeset.
204
205 dirs [ -c ] [ arg ... ]
206 dirs [ -lpv ]
207 With no arguments, print the contents of the directory stack.
208 Directories are added to this stack with the pushd command, and
209 removed with the cd or popd commands. If arguments are speci‐
210 fied, load them onto the directory stack, replacing anything
211 that was there, and push the current directory onto the stack.
212
213 -c clear the directory stack.
214
215 -l print directory names in full instead of using of using ~
216 expressions.
217
218 -p print directory entries one per line.
219
220 -v number the directories in the stack when printing.
221
222 disable [ -afmrs ] name ...
223 Temporarily disable the named hash table elements. The default
224 is to disable builtin commands. This allows you to use an
225 external command with the same name as a builtin command. The
226 -a option causes disable to act on regular or global aliases.
227 The -s option causes disable to act on suffix aliases. The -f
228 option causes disable to act on shell functions. The -r options
229 causes disable to act on reserved words. Without arguments all
230 disabled hash table elements from the corresponding hash table
231 are printed. With the -m flag the arguments are taken as pat‐
232 terns (which should be quoted to prevent them from undergoing
233 filename expansion), and all hash table elements from the corre‐
234 sponding hash table matching these patterns are disabled. Dis‐
235 abled objects can be enabled with the enable command.
236
237 disown [ job ... ]
238 job ... &|
239 job ... &!
240 Remove the specified jobs from the job table; the shell will no
241 longer report their status, and will not complain if you try to
242 exit an interactive shell with them running or stopped. If no
243 job is specified, disown the current job.
244
245 If the jobs are currently stopped and the AUTO_CONTINUE option
246 is not set, a warning is printed containing information about
247 how to make them running after they have been disowned. If one
248 of the latter two forms is used, the jobs will automatically be
249 made running, independent of the setting of the AUTO_CONTINUE
250 option.
251
252 echo [ -neE ] [ arg ... ]
253 Write each arg on the standard output, with a space separating
254 each one. If the -n flag is not present, print a newline at the
255 end. echo recognizes the following escape sequences:
256
257 \a bell character
258 \b backspace
259 \c suppress final newline
260 \e escape
261 \f form feed
262 \n linefeed (newline)
263 \r carriage return
264 \t horizontal tab
265 \v vertical tab
266 \\ backslash
267 \0NNN character code in octal
268 \xNN character code in hexadecimal
269 \uNNNN unicode character code in hexadecimal
270 \UNNNNNNNN
271 unicode character code in hexadecimal
272
273 The -E flag, or the BSD_ECHO option, can be used to disable
274 these escape sequences. In the latter case, -e flag can be used
275 to enable them.
276
277 echotc See the section `The zsh/termcap Module' in zshmodules(1).
278
279 echoti See the section `The zsh/terminfo Module' in zshmodules(1).
280
281 emulate [ -LR ] {zsh|sh|ksh|csh}
282 Set up zsh options to emulate the specified shell as much as
283 possible. csh will never be fully emulated. If the argument is
284 not one of the shells listed above, zsh will be used as a
285 default; more precisely, the tests performed on the argument are
286 the same as those used to determine the emulation at startup
287 based on the shell name, see the section `Compatibility' in zsh‐
288 misc(1) . If the -R option is given, all options are reset to
289 their default value corresponding to the specified emulation
290 mode, except for certain options describing the interactive
291 environment; otherwise, only those options likely to cause
292 portability problems in scripts and functions are altered. If
293 the -L option is given, the options LOCAL_OPTIONS and
294 LOCAL_TRAPS will be set as well, causing the effects of the emu‐
295 late command and any setopt and trap commands to be local to the
296 immediately surrounding shell function, if any; normally these
297 options are turned off in all emulation modes except ksh.
298
299 enable [ -afmrs ] name ...
300 Enable the named hash table elements, presumably disabled ear‐
301 lier with disable. The default is to enable builtin commands.
302 The -a option causes enable to act on regular or global aliases.
303 The -s option causes enable to act on suffix aliases. The -f
304 option causes enable to act on shell functions. The -r option
305 causes enable to act on reserved words. Without arguments all
306 enabled hash table elements from the corresponding hash table
307 are printed. With the -m flag the arguments are taken as pat‐
308 terns (should be quoted) and all hash table elements from the
309 corresponding hash table matching these patterns are enabled.
310 Enabled objects can be disabled with the disable builtin com‐
311 mand.
312
313 eval [ arg ... ]
314 Read the arguments as input to the shell and execute the result‐
315 ing command in the current shell process.
316
317 exec simple command
318 See the section `Precommand Modifiers'.
319
320 exit [ n ]
321 Exit the shell with the exit code specified by n; if none is
322 specified, use the exit code from the last command executed. An
323 EOF condition will also cause the shell to exit, unless the
324 IGNORE_EOF option is set.
325
326 export [ name[=value] ... ]
327 The specified names are marked for automatic export to the envi‐
328 ronment of subsequently executed commands. Equivalent to type‐
329 set -gx. If a parameter specified does not already exist, it is
330 created in the global scope.
331
332 false [ arg ... ]
333 Do nothing and return an exit code of 1.
334
335 fc [ -e ename ] [ -nlrdDfEim ] [ old=new ... ] [ first [ last ] ]
336 fc -p [ -a ] [ filename [ histsize [ savehistsize ] ] ]
337 fc -P
338 fc -ARWI [ filename ]
339 Select a range of commands from first to last from the history
340 list. The arguments first and last may be specified as a number
341 or as a string. A negative number is used as an offset to the
342 current history event number. A string specifies the most
343 recent event beginning with the given string. All substitutions
344 old=new, if any, are then performed on the commands.
345
346 If the -l flag is given, the resulting commands are listed on
347 standard output. If the -m flag is also given the first argu‐
348 ment is taken as a pattern (should be quoted) and only the his‐
349 tory events matching this pattern will be shown. Otherwise the
350 editor program ename is invoked on a file containing these his‐
351 tory events. If ename is not given, the value of the parameter
352 FCEDIT is used. If ename is `-', no editor is invoked. When
353 editing is complete, the edited command is executed.
354
355 If first is not specified, it will be set to -1 (the most recent
356 event), or to -16 if the -l flag is given. If last is not spec‐
357 ified, it will be set to first, or to -1 if the -l flag is
358 given.
359
360 The flag -r reverses the order of the commands and the flag -n
361 suppresses command numbers when listing. Also when listing, -d
362 prints timestamps for each command, and -f prints full time-date
363 stamps. Adding the -E flag causes the dates to be printed as
364 `dd.mm.yyyy', instead of the default `mm/dd/yyyy'. Adding the
365 -i flag causes the dates to be printed in ISO8601 `yyyy-mm-dd'
366 format. With the -D flag, fc prints elapsed times.
367
368 `fc -p' pushes the current history list onto a stack and
369 switches to a new history list. If the -a option is also speci‐
370 fied, this history list will be automatically popped when the
371 current function scope is exited, which is a much better solu‐
372 tion than creating a trap function to call `fc -P' manually. If
373 no arguments are specified, the history list is left empty,
374 $HISTFILE is unset, and $HISTSIZE & $SAVEHIST are set to their
375 default values. If one argument is given, $HISTFILE is set to
376 that filename, $HISTSIZE & $SAVEHIST are left unchanged, and the
377 history file is read in (if it exists) to initialize the new
378 list. If a second argument is specified, $HISTSIZE & $SAVEHIST
379 are instead set to the single specified numeric value. Finally,
380 if a third argument is specified, $SAVEHIST is set to a separate
381 value from $HISTSIZE. You are free to change these environment
382 values for the new history list however you desire in order to
383 manipulate the new history list.
384
385 `fc -P' pops the history list back to an older list saved by `fc
386 -p'. The current list is saved to its $HISTFILE before it is
387 destroyed (assuming that $HISTFILE and $SAVEHIST are set appro‐
388 priately, of course). The values of $HISTFILE, $HISTSIZE, and
389 $SAVEHIST are restored to the values they had when `fc -p' was
390 called. Note that this restoration can conflict with making
391 these variables "local", so your best bet is to avoid local dec‐
392 larations for these variables in functions that use `fc -p'.
393 The one other guaranteed-safe combination is declaring these
394 variables to be local at the top of your function and using the
395 automatic option (-a) with `fc -p'. Finally, note that it is
396 legal to manually pop a push marked for automatic popping if you
397 need to do so before the function exits.
398
399 `fc -R' reads the history from the given file, `fc -W' writes
400 the history out to the given file, and `fc -A' appends the his‐
401 tory out to the given file. If no filename is specified, the
402 $HISTFILE is assumed. If the -I option is added to -R, only
403 those events that are not already contained within the internal
404 history list are added. If the -I option is added to -A or -W,
405 only those events that are new since last incremental
406 append/write to the history file are appended/written. In any
407 case, the created file will have no more than $SAVEHIST entries.
408
409 fg [ job ... ]
410 job ...
411 Bring each specified job in turn to the foreground. If no job
412 is specified, resume the current job.
413
414 float [ {+|-}EFHghlprtux ] [ -LRZ [ n ]] [ name[=value] ... ]
415 Equivalent to typeset -E, except that options irrelevant to
416 floating point numbers are not permitted.
417
418 functions [ {+|-}UXkmtuz ] [ name ... ]
419 Equivalent to typeset -f.
420
421 getcap See the section `The zsh/cap Module' in zshmodules(1).
422
423 getln [ -AclneE ] name ...
424 Read the top value from the buffer stack and put it in the shell
425 parameter name. Equivalent to read -zr.
426
427 getopts optstring name [ arg ... ]
428 Checks the args for legal options. If the args are omitted, use
429 the positional parameters. A valid option argument begins with
430 a `+' or a `-'. An argument not beginning with a `+' or a `-',
431 or the argument `--', ends the options. Note that a single `-'
432 is not considered a valid option argument. optstring contains
433 the letters that getopts recognizes. If a letter is followed by
434 a `:', that option is expected to have an argument. The options
435 can be separated from the argument by blanks.
436
437 Each time it is invoked, getopts places the option letter it
438 finds in the shell parameter name, prepended with a `+' when arg
439 begins with a `+'. The index of the next arg is stored in
440 OPTIND. The option argument, if any, is stored in OPTARG.
441
442 The first option to be examined may be changed by explicitly
443 assigning to OPTIND. OPTIND has an initial value of 1, and is
444 normally reset to 1 upon exit from a shell function. OPTARG is
445 not reset and retains its value from the most recent call to
446 getopts. If either of OPTIND or OPTARG is explicitly unset, it
447 remains unset, and the index or option argument is not stored.
448 The option itself is still stored in name in this case.
449
450 A leading `:' in optstring causes getopts to store the letter of
451 any invalid option in OPTARG, and to set name to `?' for an
452 unknown option and to `:' when a required option is missing.
453 Otherwise, getopts sets name to `?' and prints an error message
454 when an option is invalid. The exit status is nonzero when
455 there are no more options.
456
457 hash [ -Ldfmrv ] [ name[=value] ] ...
458 hash can be used to directly modify the contents of the command
459 hash table, and the named directory hash table. Normally one
460 would modify these tables by modifying one's PATH (for the com‐
461 mand hash table) or by creating appropriate shell parameters
462 (for the named directory hash table). The choice of hash table
463 to work on is determined by the -d option; without the option
464 the command hash table is used, and with the option the named
465 directory hash table is used.
466
467 Given no arguments, and neither the -r or -f options, the
468 selected hash table will be listed in full.
469
470 The -r option causes the selected hash table to be emptied. It
471 will be subsequently rebuilt in the normal fashion. The -f
472 option causes the selected hash table to be fully rebuilt imme‐
473 diately. For the command hash table this hashes all the abso‐
474 lute directories in the PATH, and for the named directory hash
475 table this adds all users' home directories. These two options
476 cannot be used with any arguments.
477
478 The -m option causes the arguments to be taken as patterns
479 (which should be quoted) and the elements of the hash table
480 matching those patterns are printed. This is the only way to
481 display a limited selection of hash table elements.
482
483 For each name with a corresponding value, put `name' in the
484 selected hash table, associating it with the pathname `value'.
485 In the command hash table, this means that whenever `name' is
486 used as a command argument, the shell will try to execute the
487 file given by `value'. In the named directory hash table, this
488 means that `value' may be referred to as `~name'.
489
490 For each name with no corresponding value, attempt to add name
491 to the hash table, checking what the appropriate value is in the
492 normal manner for that hash table. If an appropriate value
493 can't be found, then the hash table will be unchanged.
494
495 The -v option causes hash table entries to be listed as they are
496 added by explicit specification. If has no effect if used with
497 -f.
498
499 If the -L flag is present, then each hash table entry is printed
500 in the form of a call to hash.
501
502 history
503 Same as fc -l.
504
505 integer [ {+|-}Hghilprtux ] [ -LRZ [ n ]] [ name[=value] ... ]
506 Equivalent to typeset -i, except that options irrelevant to
507 integers are not permitted.
508
509 jobs [ -dlprs ] [ job ... ]
510 jobs -Z string
511 Lists information about each given job, or all jobs if job is
512 omitted. The -l flag lists process IDs, and the -p flag lists
513 process groups. If the -r flag is specified only running jobs
514 will be listed and if the -s flag is given only stopped jobs are
515 shown. If the -d flag is given, the directory from which the
516 job was started (which may not be the current directory of the
517 job) will also be shown.
518
519 The -Z option replaces the shell's argument and environment
520 space with the given string, truncated if necessary to fit.
521 This will normally be visible in ps (ps(1)) listings. This fea‐
522 ture is typically used by daemons, to indicate their state.
523
524 kill [ -s signal_name | -n signal_number | -sig ] job ...
525 kill -l [ sig ... ]
526 Sends either SIGTERM or the specified signal to the given jobs
527 or processes. Signals are given by number or by names, with or
528 without the `SIG' prefix. If the signal being sent is not
529 `KILL' or `CONT', then the job will be sent a `CONT' signal if
530 it is stopped. The argument job can be the process ID of a job
531 not in the job list. In the second form, kill -l, if sig is not
532 specified the signal names are listed. Otherwise, for each sig
533 that is a name, the corresponding signal number is listed. For
534 each sig that is a signal number or a number representing the
535 exit status of a process which was terminated or stopped by a
536 signal the name of the signal is printed.
537
538 On some systems, alternative signal names are allowed for a few
539 signals. Typical examples are SIGCHLD and SIGCLD or SIGPOLL and
540 SIGIO, assuming they correspond to the same signal number. kill
541 -l will only list the preferred form, however kill -l alt will
542 show if the alternative form corresponds to a signal number.
543 For example, under Linux kill -l IO and kill -l POLL both output
544 29, hence kill -IO and kill -POLL have the same effect.
545
546 let arg ...
547 Evaluate each arg as an arithmetic expression. See the section
548 `Arithmetic Evaluation' for a description of arithmetic expres‐
549 sions. The exit status is 0 if the value of the last expression
550 is nonzero, and 1 otherwise.
551
552 limit [ -hs ] [ resource [ limit ] ] ...
553 Set or display resource limits. Unless the -s flag is given,
554 the limit applies only the children of the shell. If -s is
555 given without other arguments, the resource limits of the cur‐
556 rent shell is set to the previously set resource limits of the
557 children.
558
559 If limit is not specified, print the current limit placed on
560 resource, otherwise set the limit to the specified value. If
561 the -h flag is given, use hard limits instead of soft limits.
562 If no resource is given, print all limits.
563
564 When looping over multiple resources, the shell will abort imme‐
565 diately if it detects a badly formed argument. However, if it
566 fails to set a limit for some other reason it will continue try‐
567 ing to set the remaining limits.
568
569 resource can be one of:
570
571 addressspace
572 Maximum amount of address space used.
573 aiomemorylocked
574 Maximum amount of memory locked in RAM for AIO opera‐
575 tions.
576 aiooperations
577 Maximum number of AIO operations.
578 cachedthreads
579 Maximum number of cached threads.
580 coredumpsize
581 Maximum size of a core dump.
582 cputime
583 Maximum CPU seconds per process.
584 datasize
585 Maximum data size (including stack) for each process.
586 descriptors
587 Maximum value for a file descriptor.
588 filesize
589 Largest single file allowed.
590 maxproc
591 Maximum number of processes.
592 maxpthreads
593 Maximum number of threads per process.
594 memorylocked
595 Maximum amount of memory locked in RAM.
596 memoryuse
597 Maximum resident set size.
598 msgqueue
599 Maximum number of bytes in POSIX message queues.
600 resident
601 Maximum resident set size.
602 sigpending
603 Maximum number of pending signals.
604 sockbufsize
605 Maximum size of all socket buffers.
606 stacksize
607 Maximum stack size for each process.
608 vmemorysize
609 Maximum amount of virtual memory.
610
611 Which of these resource limits are available depends on the sys‐
612 tem. resource can be abbreviated to any unambiguous prefix. It
613 can also be an integer, which corresponds to the integer defined
614 for the resource by the operating system.
615
616 If argument corresponds to a number which is out of the range of
617 the resources configured into the shell, the shell will try to
618 read or write the limit anyway, and will report an error if this
619 fails. As the shell does not store such resources internally,
620 an attempt to set the limit will fail unless the -s option is
621 present.
622
623 limit is a number, with an optional scaling factor, as follows:
624
625 nh hours
626 nk kilobytes (default)
627 nm megabytes or minutes
628 [mm:]ss
629 minutes and seconds
630
631 local [ {+|-}AEFHUahlprtux ] [ -LRZi [ n ]] [ name[=value] ] ...
632 Same as typeset, except that the options -g, and -f are not per‐
633 mitted. In this case the -x option does not force the use of
634 -g, i.e. exported variables will be local to functions.
635
636 log List all users currently logged in who are affected by the cur‐
637 rent setting of the watch parameter.
638
639 logout [ n ]
640 Same as exit, except that it only works in a login shell.
641
642 noglob simple command
643 See the section `Precommand Modifiers'.
644
645 popd [ {+|-}n ]
646 Remove an entry from the directory stack, and perform a cd to
647 the new top directory. With no argument, the current top entry
648 is removed. An argument of the form `+n' identifies a stack
649 entry by counting from the left of the list shown by the dirs
650 command, starting with zero. An argument of the form -n counts
651 from the right. If the PUSHD_MINUS option is set, the meanings
652 of `+' and `-' in this context are swapped.
653
654 print [ -abcDilmnNoOpPrsz ] [ -u n ] [ -f format ] [ -C cols ]
655 [ -R [ -en ]] [ arg ... ]
656 With the `-f' option the arguments are printed as described by
657 printf. With no flags or with the flag `-', the arguments are
658 printed on the standard output as described by echo, with the
659 following differences: the escape sequence `\M-x' metafies the
660 character x (sets the highest bit), `\C-x' produces a control
661 character (`\C-@' and `\C-?' give the characters NUL and
662 delete), and `\E' is a synonym for `\e'. Finally, if not in an
663 escape sequence, `\' escapes the following character and is not
664 printed.
665
666 -a Print arguments with the column incrementing first. Only
667 useful with the -c and -C options.
668
669 -b Recognize all the escape sequences defined for the bind‐
670 key command, see zshzle(1).
671
672 -c Print the arguments in columns. Unless -a is also given,
673 arguments are printed with the row incrementing first.
674
675 -C cols
676 Print the arguments in cols columns. Unless -a is also
677 given, arguments are printed with the row incrementing
678 first.
679
680 -D Treat the arguments as directory names, replacing pre‐
681 fixes with ~ expressions, as appropriate.
682
683 -i If given together with -o or -O, sorting is performed
684 case-independently.
685
686 -l Print the arguments separated by newlines instead of spa‐
687 ces.
688
689 -m Take the first argument as a pattern (should be quoted),
690 and remove it from the argument list together with subse‐
691 quent arguments that do not match this pattern.
692
693 -n Do not add a newline to the output.
694
695 -N Print the arguments separated and terminated by nulls.
696
697 -o Print the arguments sorted in ascending order.
698
699 -O Print the arguments sorted in descending order.
700
701 -p Print the arguments to the input of the coprocess.
702
703 -P Perform prompt expansion (see zshmisc(1)).
704
705 -r Ignore the escape conventions of echo.
706
707 -R Emulate the BSD echo command, which does not process
708 escape sequences unless the -e flag is given. The -n
709 flag suppresses the trailing newline. Only the -e and -n
710 flags are recognized after -R; all other arguments and
711 options are printed.
712
713 -s Place the results in the history list instead of on the
714 standard output.
715
716 -u n Print the arguments to file descriptor n.
717
718 -z Push the arguments onto the editing buffer stack, sepa‐
719 rated by spaces.
720
721 If any of `-m', `-o' or `-O' are used in combination with `-f'
722 and there are no arguments (after the removal process in the
723 case of `-m') then nothing is printed.
724
725 printf format [ arg ... ]
726 Print the arguments according to the format specification. For‐
727 matting rules are the same as used in C. The same escape
728 sequences as for echo are recognised in the format. All C con‐
729 version specifications ending in one of csdiouxXeEfgGn are han‐
730 dled. In addition to this, `%b' can be used instead of `%s' to
731 cause escape sequences in the argument to be recognised and `%q'
732 can be used to quote the argument in such a way that allows it
733 to be reused as shell input. With the numeric format specifiers,
734 if the corresponding argument starts with a quote character, the
735 numeric value of the following character is used as the number
736 to print otherwise the argument is evaluated as an arithmetic
737 expression. See the section `Arithmetic Evaluation' for a
738 description of arithmetic expressions. With `%n', the corre‐
739 sponding argument is taken as an identifier which is created as
740 an integer parameter.
741
742 Normally, conversion specifications are applied to each argument
743 in order but they can explicitly specify the nth argument is to
744 be used by replacing `%' by `%n$' and `*' by `*n$'. It is rec‐
745 ommended that you do not mix references of this explicit style
746 with the normal style and the handling of such mixed styles may
747 be subject to future change.
748
749 If arguments remain unused after formatting, the format string
750 is reused until all arguments have been consumed. With the print
751 builtin, this can be suppressed by using the -r option. If more
752 arguments are required by the format than have been specified,
753 the behaviour is as if zero or an empty string had been speci‐
754 fied as the argument.
755
756 pushd [ -sLP ] [ arg ]
757 pushd [ -sLP ] old new
758 pushd [ -sLP ] {+|-}n
759 Change the current directory, and push the old current directory
760 onto the directory stack. In the first form, change the current
761 directory to arg. If arg is not specified, change to the second
762 directory on the stack (that is, exchange the top two entries),
763 or change to $HOME if the PUSHD_TO_HOME option is set or if
764 there is only one entry on the stack. Otherwise, arg is inter‐
765 preted as it would be by cd. The meaning of old and new in the
766 second form is also the same as for cd.
767
768 The third form of pushd changes directory by rotating the direc‐
769 tory list. An argument of the form `+n' identifies a stack
770 entry by counting from the left of the list shown by the dirs
771 command, starting with zero. An argument of the form `-n'
772 counts from the right. If the PUSHD_MINUS option is set, the
773 meanings of `+' and `-' in this context are swapped.
774
775 If the option PUSHD_SILENT is not set, the directory stack will
776 be printed after a pushd is performed.
777
778 The options -s, -L and -P have the same meanings as for the cd
779 builtin.
780
781 pushln [ arg ... ]
782 Equivalent to print -nz.
783
784 pwd [ -rLP ]
785 Print the absolute pathname of the current working directory.
786 If the -r or the -P flag is specified, or the CHASE_LINKS option
787 is set and the -L flag is not given, the printed path will not
788 contain symbolic links.
789
790 r Same as fc -e -.
791
792 read [ -rszpqAclneE ] [ -t [ num ] ] [ -k [ num ] ] [ -d delim ]
793 [ -u n ] [ name[?prompt] ] [ name ... ]
794 Read one line and break it into fields using the characters in
795 $IFS as separators, except as noted below. The first field is
796 assigned to the first name, the second field to the second name,
797 etc., with leftover fields assigned to the last name. If name
798 is omitted then REPLY is used for scalars and reply for arrays.
799
800 -r Raw mode: a `\' at the end of a line does not signify
801 line continuation and backslashes in the line don't quote
802 the following character and are not removed.
803
804 -s Don't echo back characters if reading from the terminal.
805 Currently does not work with the -q option.
806
807 -q Read only one character from the terminal and set name to
808 `y' if this character was `y' or `Y' and to `n' other‐
809 wise. With this flag set the return value is zero only
810 if the character was `y' or `Y'. Note that this always
811 reads from the terminal, even if used with the -p or -u
812 or -z flags or with redirected input. This option may
813 also be used within zle widgets.
814
815 -k [ num ]
816 Read only one (or num) characters. All are assigned to
817 the first name, without word splitting. This flag is
818 ignored when -q is present. Input is read from the ter‐
819 minal unless one of -u or -p is present. This option may
820 also be used within zle widgets.
821
822 -z Read one entry from the editor buffer stack and assign it
823 to the first name, without word splitting. Text is
824 pushed onto the stack with `print -z' or with push-line
825 from the line editor (see zshzle(1)). This flag is
826 ignored when the -k or -q flags are present.
827
828 -e
829 -E The input read is printed (echoed) to the standard out‐
830 put. If the -e flag is used, no input is assigned to the
831 parameters.
832
833 -A The first name is taken as the name of an array and all
834 words are assigned to it.
835
836 -c
837 -l These flags are allowed only if called inside a function
838 used for completion (specified with the -K flag to com‐
839 pctl). If the -c flag is given, the words of the current
840 command are read. If the -l flag is given, the whole line
841 is assigned as a scalar. If both flags are present, -l
842 is used and -c is ignored.
843
844 -n Together with -c, the number of the word the cursor is on
845 is read. With -l, the index of the character the cursor
846 is on is read. Note that the command name is word number
847 1, not word 0, and that when the cursor is at the end of
848 the line, its character index is the length of the line
849 plus one.
850
851 -u n Input is read from file descriptor n.
852
853 -p Input is read from the coprocess.
854
855 -d delim
856 Input is terminated by the first character of delim
857 instead of by newline.
858
859 -t [ num ]
860 Test if input is available before attempting to read. If
861 num is present, it must begin with a digit and will be
862 evaluated to give a number of seconds, which may be a
863 floating point number; in this case the read times out if
864 input is not available within this time. If num is not
865 present, it is taken to be zero, so that read returns
866 immediately if no input is available. If no input is
867 available, return status 1 and do not set any variables.
868
869 This option is not available when reading from the editor
870 buffer with -z, when called from within completion with
871 -c or -l, with -q which clears the input queue before
872 reading, or within zle where other mechanisms should be
873 used to test for input.
874
875 Note that read does not attempt to alter the input pro‐
876 cessing mode. The default mode is canonical input, in
877 which an entire line is read at a time, so usually `read
878 -t' will not read anything until an entire line has been
879 typed. However, when reading from the terminal with -k
880 input is processed one key at a time; in this case, only
881 availability of the first character is tested, so that
882 e.g. `read -t -k 2' can still block on the second charac‐
883 ter. Use two instances of `read -t -k' if this is not
884 what is wanted. If the first argument contains a `?',
885 the remainder of this word is used as a prompt on stan‐
886 dard error when the shell is interactive.
887
888 The value (exit status) of read is 1 when an end-of-file is
889 encountered, or when -c or -l is present and the command is not
890 called from a compctl function, or as described for -q. Other‐
891 wise the value is 0.
892
893 The behavior of some combinations of the -k, -p, -q, -u and -z
894 flags is undefined. Presently -q cancels all the others, -p
895 cancels -u, -k cancels -z, and otherwise -z cancels both -p and
896 -u.
897
898 The -c or -l flags cancel any and all of -kpquz.
899
900 readonly
901 Same as typeset -r.
902
903 rehash Same as hash -r.
904
905 return [ n ]
906 Causes a shell function or . script to return to the invoking
907 script with the return status specified by n. If n is omitted,
908 the return status is that of the last command executed.
909
910 If return was executed from a trap in a TRAPNAL function, the
911 effect is different for zero and non-zero return status. With
912 zero status (or after an implicit return at the end of the
913 trap), the shell will return to whatever it was previously pro‐
914 cessing; with a non-zero status, the shell will behave as inter‐
915 rupted except that the return status of the trap is retained.
916 Note that the numeric value of the signal which caused the trap
917 is passed as the first argument, so the statement `return
918 $((128+$1))' will return the same status as if the signal had
919 not been trapped.
920
921 sched See the section `The zsh/sched Module' in zshmodules(1).
922
923 set [ {+|-}options | {+|-}o [ option_name ] ] ... [ {+|-}A [ name ] ] [
924 arg ... ]
925 Set the options for the shell and/or set the positional parame‐
926 ters, or declare and set an array. If the -s option is given,
927 it causes the specified arguments to be sorted before assigning
928 them to the positional parameters (or to the array name if -A is
929 used). With +s sort arguments in descending order. For the
930 meaning of the other flags, see zshoptions(1). Flags may be
931 specified by name using the -o option. If no option name is sup‐
932 plied with -o, the current option states are printed. With +o
933 they are printed in a form that can be used as input to the
934 shell.
935
936 If the -A flag is specified, name is set to an array containing
937 the given args; if no name is specified, all arrays are printed
938 together with their values.
939
940 If +A is used and name is an array, the given arguments will
941 replace the initial elements of that array; if no name is speci‐
942 fied, all arrays are printed without their values.
943
944 The behaviour of arguments after -A name or +A name depends on
945 whether the option KSH_ARRAYS is set. If it is not set, all
946 arguments following name are treated as values for the array,
947 regardless of their form. If the option is set, normal option
948 processing continues at that point; only regular arguments are
949 treated as values for the array. This means that
950
951 set -A array -x -- foo
952
953 sets array to `-x -- foo' if KSH_ARRAYS is not set, but sets the
954 array to foo and turns on the option `-x' if it is set.
955
956 If the -A flag is not present, but there are arguments beyond
957 the options, the positional parameters are set. If the option
958 list (if any) is terminated by `--', and there are no further
959 arguments, the positional parameters will be unset.
960
961 If no arguments and no `--' are given, then the names and values
962 of all parameters are printed on the standard output. If the
963 only argument is `+', the names of all parameters are printed.
964
965 setcap See the section `The zsh/cap Module' in zshmodules(1).
966
967 setopt [ {+|-}options | {+|-}o option_name ] [ name ... ]
968 Set the options for the shell. All options specified either
969 with flags or by name are set. If no arguments are supplied,
970 the names of all options currently set are printed. If the -m
971 flag is given the arguments are taken as patterns (which should
972 be quoted to protect them from filename expansion), and all
973 options with names matching these patterns are set.
974
975 shift [ n ] [ name ... ]
976 The positional parameters ${n+1} ... are renamed to $1 ...,
977 where n is an arithmetic expression that defaults to 1. If any
978 names are given then the arrays with these names are shifted
979 instead of the positional parameters.
980
981 source file [ arg ... ]
982 Same as ., except that the current directory is always searched
983 and is always searched first, before directories in $path.
984
985 stat See the section `The zsh/stat Module' in zshmodules(1).
986
987 suspend [ -f ]
988 Suspend the execution of the shell (send it a SIGTSTP) until it
989 receives a SIGCONT. Unless the -f option is given, this will
990 refuse to suspend a login shell.
991
992 test [ arg ... ]
993 [ [ arg ... ] ]
994 Like the system version of test. Added for compatibility; use
995 conditional expressions instead (see the section `Conditional
996 Expressions'). The main differences between the conditional
997 expression syntax and the test and [ builtins are: these com‐
998 mands are not handled syntactically, so for example an empty
999 variable expansion may cause an argument to be omitted; syntax
1000 errors cause status 2 to be returned instead of a shell error;
1001 and arithmetic operators expect integer arguments rather than
1002 arithemetic expressions.
1003
1004 times Print the accumulated user and system times for the shell and
1005 for processes run from the shell.
1006
1007 trap [ arg [ sig ... ] ]
1008 arg is a series of commands (usually quoted to protect it from
1009 immediate evaluation by the shell) to be read and executed when
1010 the shell receives sig. Each sig can be given as a number or as
1011 the name of a signal. If arg is `-', then all traps sig are
1012 reset to their default values. If arg is the empty string, then
1013 this signal is ignored by the shell and by the commands it
1014 invokes.
1015
1016 If sig is ZERR then arg will be executed after each command with
1017 a nonzero exit status. If sig is DEBUG then arg will be exe‐
1018 cuted after each command. If sig is 0 or EXIT and the trap
1019 statement is executed inside the body of a function, then the
1020 command arg is executed after the function completes. If sig is
1021 0 or EXIT and the trap statement is not executed inside the body
1022 of a function, then the command arg is executed when the shell
1023 terminates.
1024
1025 ZERR, DEBUG and EXIT traps are not executed inside other traps.
1026
1027 The trap command with no arguments prints a list of commands
1028 associated with each signal.
1029
1030 Note that traps defined with the trap builtin are slightly dif‐
1031 ferent from those defined as `TRAPNAL () { ... }', as the latter
1032 have their own function environment (line numbers, local vari‐
1033 ables, etc.) while the former use the environment of the command
1034 in which they were called. For example,
1035
1036 trap 'print $LINENO' DEBUG
1037
1038 will print the line number of a command executed after it has
1039 run, while
1040
1041 TRAPDEBUG() { print $LINENO; }
1042
1043 will always print the number zero.
1044
1045 Alternative signal names are allowed as described under kill
1046 above. Defining a trap under either name causes any trap under
1047 an alternative name to be removed. However, it is recommended
1048 that for consistency users stick exclusively to one name or
1049 another.
1050
1051 true [ arg ... ]
1052 Do nothing and return an exit code of 0.
1053
1054 ttyctl -fu
1055 The -f option freezes the tty, and -u unfreezes it. When the
1056 tty is frozen, no changes made to the tty settings by external
1057 programs will be honored by the shell, except for changes in the
1058 size of the screen; the shell will simply reset the settings to
1059 their previous values as soon as each command exits or is sus‐
1060 pended. Thus, stty and similar programs have no effect when the
1061 tty is frozen. Without options it reports whether the terminal
1062 is frozen or not.
1063
1064 type [ -wfpams ] name ...
1065 Equivalent to whence -v.
1066
1067 typeset [ {+|-}AEFHUafghklprtuxmz ] [ -LRZi [ n ]] [ name[=value] ... ]
1068 typeset -T [ {+|-}Urux ] [ -LRZ [ n ]] SCALAR[=value] array [ sep ]
1069 Set or display attributes and values for shell parameters.
1070
1071 A parameter is created for each name that does not already refer
1072 to one. When inside a function, a new parameter is created for
1073 every name (even those that already exist), and is unset again
1074 when the function completes. See `Local Parameters' in zsh‐
1075 param(1). The same rules apply to special shell parameters,
1076 which retain their special attributes when made local.
1077
1078 For each name=value assignment, the parameter name is set to
1079 value. Note that arrays currently cannot be assigned in typeset
1080 expressions, only scalars and integers.
1081
1082 If the shell option TYPESET_SILENT is not set, for each remain‐
1083 ing name that refers to a parameter that is set, the name and
1084 value of the parameter are printed in the form of an assignment.
1085 Nothing is printed for newly-created parameters, or when any
1086 attribute flags listed below are given along with the name.
1087 Using `+' instead of minus to introduce an attribute turns it
1088 off.
1089
1090 If the -p option is given, parameters and values are printed in
1091 the form of a typeset comand and an assignment (which will be
1092 printed separately for arrays and associative arrays), regard‐
1093 less of other flags and options. Note that the -h flag on
1094 parameters is respected; no value will be shown for these param‐
1095 eters.
1096
1097 If the -T option is given, two or three arguments must be
1098 present (an exception is that zero arguments are allowed to show
1099 the list of parameters created in this fashion). The first two
1100 are the name of a scalar and an array parameter (in that order)
1101 that will be tied together in the manner of $PATH and $path.
1102 The optional third argument is a single-character separator
1103 which will be used to join the elements of the array to form the
1104 scalar; if absent, a colon is used, as with $PATH. Only the
1105 first character of the separator is significant; any remaining
1106 characters are ignored. Only the scalar parameter may be
1107 assigned an initial value. Both the scalar and the array may
1108 otherwise be manipulated as normal. If one is unset, the other
1109 will automatically be unset too. There is no way of untying the
1110 variables without unsetting them, or converting the type of one
1111 of them with another typeset command; +T does not work, assign‐
1112 ing an array to SCALAR is an error, and assigning a scalar to
1113 array sets it to be a single-element array. Note that both
1114 `typeset -xT ...' and `export -T ...' work, but only the scalar
1115 will be marked for export. Setting the value using the scalar
1116 version causes a split on all separators (which cannot be
1117 quoted).
1118
1119 The -g (global) flag is treated specially: it means that any
1120 resulting parameter will not be restricted to local scope. Note
1121 that this does not necessarily mean that the parameter will be
1122 global, as the flag will apply to any existing parameter (even
1123 if unset) from an enclosing function. This flag does not affect
1124 the parameter after creation, hence it has no effect when list‐
1125 ing existing parameters, nor does the flag +g have any effect
1126 except in combination with -m (see below).
1127
1128 If no name is present, the names and values of all parameters
1129 are printed. In this case the attribute flags restrict the dis‐
1130 play to only those parameters that have the specified
1131 attributes, and using `+' rather than `-' to introduce the flag
1132 suppresses printing of the values of parameters when there is no
1133 parameter name. Also, if the last option is the word `+', then
1134 names are printed but values are not.
1135
1136 If the -m flag is given the name arguments are taken as patterns
1137 (which should be quoted). With no attribute flags, all parame‐
1138 ters (or functions with the -f flag) with matching names are
1139 printed (the shell option TYPESET_SILENT is not used in this
1140 case). Note that -m is ignored if no patterns are given. If
1141 the +g flag is combined with -m, a new local parameter is cre‐
1142 ated for every matching parameter that is not already local.
1143 Otherwise -m applies all other flags or assignments to the
1144 existing parameters. Except when assignments are made with
1145 name=value, using +m forces the matching parameters to be
1146 printed, even inside a function.
1147
1148 If no attribute flags are given and either no -m flag is present
1149 or the +m form was used, each parameter name printed is preceded
1150 by a list of the attributes of that parameter (array, associa‐
1151 tion, exported, integer, readonly). If +m is used with
1152 attribute flags, and all those flags are introduced with +, the
1153 matching parameter names are printed but their values are not.
1154
1155 The following attribute flags may be specified:
1156
1157 -A The names refer to associative array parameters; see
1158 `Array Parameters' in zshparam(1).
1159
1160 -L Left justify and remove leading blanks from value. If n
1161 is nonzero, it defines the width of the field. If n is
1162 zero, the width is determined by the width of the value
1163 of the first assignment. In the case of numeric parame‐
1164 ters, the length of the complete value assigned to the
1165 parameter is used to determine the width, not the value
1166 that would be output. When the parameter is expanded, it
1167 is filled on the right with blanks or truncated if neces‐
1168 sary to fit the field. Note truncation can lead to unex‐
1169 pected results with numeric parameters. Leading zeros
1170 are removed if the -Z flag is also set.
1171
1172 -R Similar to -L, except that right justification is used;
1173 when the parameter is expanded, the field is left filled
1174 with blanks or truncated from the end. May not be com‐
1175 bined with the -Z flag.
1176
1177 -U For arrays (but not for associative arrays), keep only
1178 the first occurrence of each duplicated value. This may
1179 also be set for colon-separated special parameters like
1180 PATH or FIGNORE, etc. This flag has a different meaning
1181 when used with -f; see below.
1182
1183 -Z Specially handled if set along with the -L flag. Other‐
1184 wise, similar to -R, except that leading zeros are used
1185 for padding instead of blanks if the first non-blank
1186 character is a digit. Numeric parameters are specially
1187 handled: they are always eligible for padding with
1188 zeroes, and the zeroes are inserted at an appropriate
1189 place in the output.
1190
1191 -a The names refer to array parameters. An array parameter
1192 may be created this way, but it may not be assigned to in
1193 the typeset statement. When displaying, both normal and
1194 associative arrays are shown.
1195
1196 -f The names refer to functions rather than parameters. No
1197 assignments can be made, and the only other valid flags
1198 are -t, -k, -u, -U and -z. The flag -t turns on execu‐
1199 tion tracing for this function. The -u and -U flags
1200 cause the function to be marked for autoloading; -U also
1201 causes alias expansion to be suppressed when the function
1202 is loaded. The fpath parameter will be searched to find
1203 the function definition when the function is first refer‐
1204 enced; see the section `Functions'. The -k and -z flags
1205 make the function be loaded using ksh-style or zsh-style
1206 autoloading respectively. If neither is given, the set‐
1207 ting of the KSH_AUTOLOAD option determines how the func‐
1208 tion is loaded.
1209
1210 -h Hide: only useful for special parameters (those marked
1211 `<S>' in the table in zshparams(1)), and for local param‐
1212 eters with the same name as a special parameter, though
1213 harmless for others. A special parameter with this
1214 attribute will not retain its special effect when made
1215 local. Thus after `typeset -h PATH', a function contain‐
1216 ing `typeset PATH' will create an ordinary local parame‐
1217 ter without the usual behaviour of PATH. Alternatively,
1218 the local parameter may itself be given this attribute;
1219 hence inside a function `typeset -h PATH' creates an
1220 ordinary local parameter and the special PATH parameter
1221 is not altered in any way. It is also possible to create
1222 a local parameter using `typeset +h special', where the
1223 local copy of special will retain its special properties
1224 regardless of having the -h attribute. Global special
1225 parameters loaded from shell modules (currently those in
1226 zsh/mapfile and zsh/parameter) are automatically given
1227 the -h attribute to avoid name clashes.
1228
1229 -H Hide value: specifies that typeset will not display the
1230 value of the parameter when listing parameters; the dis‐
1231 play for such parameters is always as if the `+' flag had
1232 been given. Use of the parameter is in other respects
1233 normal, and the option does not apply if the parameter is
1234 specified by name, or by pattern with the -m option.
1235 This is on by default for the parameters in the
1236 zsh/parameter and zsh/mapfile modules. Note, however,
1237 that unlike the -h flag this is also useful for non-spe‐
1238 cial parameters.
1239
1240 -i Use an internal integer representation. If n is nonzero
1241 it defines the output arithmetic base, otherwise it is
1242 determined by the first assignment.
1243
1244 -E Use an internal double-precision floating point represen‐
1245 tation. On output the variable will be converted to sci‐
1246 entific notation. If n is nonzero it defines the number
1247 of significant figures to display; the default is ten.
1248
1249 -F Use an internal double-precision floating point represen‐
1250 tation. On output the variable will be converted to
1251 fixed-point decimal notation. If n is nonzero it defines
1252 the number of digits to display after the decimal point;
1253 the default is ten.
1254
1255 -l Convert the result to lower case whenever the parameter
1256 is expanded. The value is not converted when assigned.
1257
1258 -r The given names are marked readonly. Note that if name
1259 is a special parameter, the readonly attribute can be
1260 turned on, but cannot then be turned off.
1261
1262 -t Tags the named parameters. Tags have no special meaning
1263 to the shell. This flag has a different meaning when
1264 used with -f; see above.
1265
1266 -u Convert the result to upper case whenever the parameter
1267 is expanded. The value is not converted when assigned.
1268 This flag has a different meaning when used with -f; see
1269 above.
1270
1271 -x Mark for automatic export to the environment of subse‐
1272 quently executed commands. If the option GLOBAL_EXPORT
1273 is set, this implies the option -g, unless +g is also
1274 explicitly given; in other words the parameter is not
1275 made local to the enclosing function. This is for com‐
1276 patibility with previous versions of zsh.
1277
1278 ulimit [ [ -SHacdfilmnpqstvx | -N resource [ limit ] ... ]
1279 Set or display resource limits of the shell and the processes
1280 started by the shell. The value of limit can be a number in the
1281 unit specified below or the value `unlimited'. By default, only
1282 soft limits are manipulated. If the -H flag is given use hard
1283 limits instead of soft limits. If the -S flag is given together
1284 with the -H flag set both hard and soft limits. If no options
1285 are used, the file size limit (-f) is assumed. If limit is
1286 omitted the current value of the specified resources are
1287 printed. When more than one resource values are printed the
1288 limit name and unit is printed before each value.
1289
1290 When looping over multiple resources, the shell will abort imme‐
1291 diately if it detects a badly formed argument. However, if it
1292 fails to set a limit for some other reson it will continue try‐
1293 ing to set the remaining limits.
1294
1295 -a Lists all of the current resource limits.
1296 -c 512-byte blocks on the size of core dumps.
1297 -d K-bytes on the size of the data segment.
1298 -f 512-byte blocks on the size of files written.
1299 -i The number of pending signals.
1300 -l K-bytes on the size of locked-in memory.
1301 -m K-bytes on the size of physical memory.
1302 -n open file descriptors.
1303 -q Bytes in POSIX message queues.
1304 -s K-bytes on the size of the stack.
1305 -t CPU seconds to be used.
1306 -u processes available to the user.
1307 -v K-bytes on the size of virtual memory. On some systems
1308 this refers to the limit called `address space'.
1309 -x The number of locks on files.
1310
1311 A resource may also be specified by integer in the form `-N
1312 resource', where resource corresponds to the integer defined for
1313 the resource by the operating system. This may be used to set
1314 the limits for resources known to the shell which do not corre‐
1315 spond to option letters. Such limits will be shown by number in
1316 the output of `ulimit -a'.
1317
1318 The number may alternatively be out of the range of limits com‐
1319 piled into the shell. The shell will try to read or write the
1320 limit anyway, and will report an error if this fails.
1321
1322 umask [ -S ] [ mask ]
1323 The umask is set to mask. mask can be either an octal number or
1324 a symbolic value as described in chmod(1). If mask is omitted,
1325 the current value is printed. The -S option causes the mask to
1326 be printed as a symbolic value. Otherwise, the mask is printed
1327 as an octal number. Note that in the symbolic form the permis‐
1328 sions you specify are those which are to be allowed (not denied)
1329 to the users specified.
1330
1331 unalias
1332 Same as unhash -a.
1333
1334 unfunction
1335 Same as unhash -f.
1336
1337 unhash [ -adfms ] name ...
1338 Remove the element named name from an internal hash table. The
1339 default is remove elements from the command hash table. The -a
1340 option causes unhash to remove regular or global aliases. The
1341 -s option causes unhash to remove suffix aliases. The -f option
1342 causes unhash to remove shell functions. The -d options causes
1343 unhash to remove named directories. If the -m flag is given the
1344 arguments are taken as patterns (should be quoted) and all ele‐
1345 ments of the corresponding hash table with matching names will
1346 be removed.
1347
1348 unlimit [ -hs ] resource ...
1349 The resource limit for each resource is set to the hard limit.
1350 If the -h flag is given and the shell has appropriate privi‐
1351 leges, the hard resource limit for each resource is removed.
1352 The resources of the shell process are only changed if the -s
1353 flag is given.
1354
1355 unset [ -fmv ] name ...
1356 Each named parameter is unset. Local parameters remain local
1357 even if unset; they appear unset within scope, but the previous
1358 value will still reappear when the scope ends.
1359
1360 Individual elements of associative array parameters may be unset
1361 by using subscript syntax on name, which should be quoted (or
1362 the entire command prefixed with noglob) to protect the sub‐
1363 script from filename generation.
1364
1365 If the -m flag is specified the arguments are taken as patterns
1366 (should be quoted) and all parameters with matching names are
1367 unset. Note that this cannot be used when unsetting associative
1368 array elements, as the subscript will be treated as part of the
1369 pattern.
1370
1371 The -v flag specifies that name refers to parameters. This is
1372 the default behaviour.
1373
1374 unset -f is equivalent to unfunction.
1375
1376 unsetopt [ {+|-}options | {+|-}o option_name ] [ name ... ]
1377 Unset the options for the shell. All options specified either
1378 with flags or by name are unset. If no arguments are supplied,
1379 the names of all options currently unset are printed. If the -m
1380 flag is given the arguments are taken as patterns (which should
1381 be quoted to preserve them from being interpreted as glob pat‐
1382 terns), and all options with names matching these patterns are
1383 unset.
1384
1385 vared See the section `Zle Builtins' in zshzle(1).
1386
1387 wait [ job ... ]
1388 Wait for the specified jobs or processes. If job is not given
1389 then all currently active child processes are waited for. Each
1390 job can be either a job specification or the process ID of a job
1391 in the job table. The exit status from this command is that of
1392 the job waited for.
1393
1394 whence [ -vcwfpams ] name ...
1395 For each name, indicate how it would be interpreted if used as a
1396 command name.
1397
1398 -v Produce a more verbose report.
1399
1400 -c Print the results in a csh-like format. This takes
1401 precedence over -v.
1402
1403 -w For each name, print `name: word' where word is one of
1404 alias, builtin, command, function, hashed, reserved or
1405 none, according as name corresponds to an alias, a
1406 built-in command, an external command, a shell function,
1407 a command defined with the hash builtin, a reserved word,
1408 or is not recognised. This takes precedence over -v and
1409 -c.
1410
1411 -f Causes the contents of a shell function to be displayed,
1412 which would otherwise not happen unless the -c flag were
1413 used.
1414
1415 -p Do a path search for name even if it is an alias,
1416 reserved word, shell function or builtin.
1417
1418 -a Do a search for all occurrences of name throughout the
1419 command path. Normally only the first occurrence is
1420 printed.
1421
1422 -m The arguments are taken as patterns (should be quoted),
1423 and the information is displayed for each command match‐
1424 ing one of these patterns.
1425
1426 -s If a pathname contains symlinks, print the symlink-free
1427 pathname as well.
1428
1429 where [ -wpms ] name ...
1430 Equivalent to whence -ca.
1431
1432 which [ -wpams ] name ...
1433 Equivalent to whence -c.
1434
1435 zcompile [ -U ] [ -z | -k ] [ -R | -M ] file [ name ... ]
1436 zcompile -ca [ -m ] [ -R | -M ] file [ name ... ]
1437 zcompile -t file [ name ... ]
1438 This builtin command can be used to compile functions or
1439 scripts, storing the compiled form in a file, and to examine
1440 files containing the compiled form. This allows faster
1441 autoloading of functions and execution of scripts by avoiding
1442 parsing of the text when the files are read.
1443
1444 The first form (without the -c, -a or -t options) creates a com‐
1445 piled file. If only the file argument is given, the output file
1446 has the name `file.zwc' and will be placed in the same directory
1447 as the file. The shell will load the compiled file instead of
1448 the normal function file when the function is autoloaded; see
1449 the section `Autoloading Functions' in zshfunc(1) for a descrip‐
1450 tion of how autoloaded functions are searched. The extension
1451 .zwc stands for `zsh word code'.
1452
1453 If there is at least one name argument, all the named files are
1454 compiled into the output file given as the first argument. If
1455 file does not end in .zwc, this extension is automatically
1456 appended. Files containing multiple compiled functions are
1457 called `digest' files, and are intended to be used as elements
1458 of the FPATH/fpath special array.
1459
1460 The second form, with the -c or -a options, writes the compiled
1461 definitions for all the named functions into file. For -c, the
1462 names must be functions currently defined in the shell, not
1463 those marked for autoloading. Undefined functions that are
1464 marked for autoloading may be written by using the -a option, in
1465 which case the fpath is searched and the contents of the defini‐
1466 tion files for those functions, if found, are compiled into
1467 file. If both -c and -a are given, names of both defined func‐
1468 tions and functions marked for autoloading may be given. In
1469 either case, the functions in files written with the -c or -a
1470 option will be autoloaded as if the KSH_AUTOLOAD option were
1471 unset.
1472
1473 The reason for handling loaded and not-yet-loaded functions with
1474 different options is that some definition files for autoloading
1475 define multiple functions, including the function with the same
1476 name as the file, and, at the end, call that function. In such
1477 cases the output of `zcompile -c' does not include the addi‐
1478 tional functions defined in the file, and any other initializa‐
1479 tion code in the file is lost. Using `zcompile -a' captures all
1480 this extra information.
1481
1482 If the -m option is combined with -c or -a, the names are used
1483 as patterns and all functions whose names match one of these
1484 patterns will be written. If no name is given, the definitions
1485 of all functions currently defined or marked as autoloaded will
1486 be written.
1487
1488 The third form, with the -t option, examines an existing com‐
1489 piled file. Without further arguments, the names of the origi‐
1490 nal files compiled into it are listed. The first line of output
1491 shows the version of the shell which compiled the file and how
1492 the file will be used (i.e. by reading it directly or by mapping
1493 it into memory). With arguments, nothing is output and the
1494 return value is set to zero if definitions for all names were
1495 found in the compiled file, and non-zero if the definition for
1496 at least one name was not found.
1497
1498 Other options:
1499
1500 -U Aliases are not expanded when compiling the named files.
1501
1502 -R When the compiled file is read, its contents are copied
1503 into the shell's memory, rather than memory-mapped (see
1504 -M). This happens automatically on systems that do not
1505 support memory mapping.
1506
1507 When compiling scripts instead of autoloadable functions,
1508 it is often desirable to use this option; otherwise the
1509 whole file, including the code to define functions which
1510 have already been defined, will remain mapped, conse‐
1511 quently wasting memory.
1512
1513 -M The compiled file is mapped into the shell's memory when
1514 read. This is done in such a way that multiple instances
1515 of the shell running on the same host will share this
1516 mapped file. If neither -R nor -M is given, the zcompile
1517 builtin decides what to do based on the size of the com‐
1518 piled file.
1519
1520 -k
1521 -z These options are used when the compiled file contains
1522 functions which are to be autoloaded. If -z is given, the
1523 function will be autoloaded as if the KSH_AUTOLOAD option
1524 is not set, even if it is set at the time the compiled
1525 file is read, while if the -k is given, the function will
1526 be loaded as if KSH_AUTOLOAD is set. These options also
1527 take precedence over any -k or -z options specified to
1528 the autoload builtin. If neither of these options is
1529 given, the function will be loaded as determined by the
1530 setting of the KSH_AUTOLOAD option at the time the com‐
1531 piled file is read.
1532
1533 These options may also appear as many times as necessary
1534 between the listed names to specify the loading style of
1535 all following functions, up to the next -k or -z.
1536
1537 The created file always contains two versions of the com‐
1538 piled format, one for big-endian machines and one for
1539 small-endian machines. The upshot of this is that the
1540 compiled file is machine independent and if it is read or
1541 mapped, only one half of the file is actually used (and
1542 mapped).
1543
1544 zformat
1545 See the section `The zsh/zutil Module' in zshmodules(1).
1546
1547 zftp See the section `The zsh/zftp Module' in zshmodules(1).
1548
1549 zle See the section `Zle Builtins' in zshzle(1).
1550
1551 zmodload [ -dL ] [ ... ]
1552 zmodload -e [ -A ] [ ... ]
1553 zmodload [ -a [ -bcpf [ -I ] ] ] [ -iL ] ...
1554 zmodload -u [ -abcdpf [ -I ] ] [ -iL ] ...
1555 zmodload -A [ -L ] [ modalias[=module] ... ]
1556 zmodload -R modalias ...
1557 Performs operations relating to zsh's loadable modules. Loading
1558 of modules while the shell is running (`dynamical loading') is
1559 not available on all operating systems, or on all installations
1560 on a particular operating system, although the zmodload command
1561 itself is always available and can be used to manipulate modules
1562 built into versions of the shell executable without dynamical
1563 loading.
1564
1565 Without arguments the names of all currently loaded binary mod‐
1566 ules are printed. The -L option causes this list to be in the
1567 form of a series of zmodload commands. Forms with arguments
1568 are:
1569
1570 zmodload [ -i ] name ...
1571 zmodload -u [ -i ] name ...
1572 In the simplest case, zmodload loads a binary module.
1573 The module must be in a file with a name consisting of
1574 the specified name followed by a standard suffix, usually
1575 `.so' (`.sl' on HPUX). If the module to be loaded is
1576 already loaded and the -i option is given, the duplicate
1577 module is ignored. Otherwise zmodload prints an error
1578 message.
1579
1580 The named module is searched for in the same way a com‐
1581 mand is, using $module_path instead of $path. However,
1582 the path search is performed even when the module name
1583 contains a `/', which it usually does. There is no way
1584 to prevent the path search.
1585
1586 With -u, zmodload unloads modules. The same name must be
1587 given that was given when the module was loaded, but it
1588 is not necessary for the module to exist in the filesys‐
1589 tem. The -i option suppresses the error if the module is
1590 already unloaded (or was never loaded).
1591
1592 Each module has a boot and a cleanup function. The mod‐
1593 ule will not be loaded if its boot function fails. Simi‐
1594 larly a module can only be unloaded if its cleanup func‐
1595 tion runs successfully.
1596
1597 zmodload -d [ -L ] [ name ]
1598 zmodload -d name dep ...
1599 zmodload -ud name [ dep ... ]
1600 The -d option can be used to specify module dependencies.
1601 The modules named in the second and subsequent arguments
1602 will be loaded before the module named in the first argu‐
1603 ment.
1604
1605 With -d and one argument, all dependencies for that mod‐
1606 ule are listed. With -d and no arguments, all module
1607 dependencies are listed. This listing is by default in a
1608 Makefile-like format. The -L option changes this format
1609 to a list of zmodload -d commands.
1610
1611 If -d and -u are both used, dependencies are removed. If
1612 only one argument is given, all dependencies for that
1613 module are removed.
1614
1615 zmodload -ab [ -L ]
1616 zmodload -ab [ -i ] name [ builtin ... ]
1617 zmodload -ub [ -i ] builtin ...
1618 The -ab option defines autoloaded builtins. It defines
1619 the specified builtins. When any of those builtins is
1620 called, the module specified in the first argument is
1621 loaded. If only the name is given, one builtin is
1622 defined, with the same name as the module. -i suppresses
1623 the error if the builtin is already defined or
1624 autoloaded, regardless of which module it came from.
1625
1626 With -ab and no arguments, all autoloaded builtins are
1627 listed, with the module name (if different) shown in
1628 parentheses after the builtin name. The -L option
1629 changes this format to a list of zmodload -a commands.
1630
1631 If -b is used together with the -u option, it removes
1632 builtins previously defined with -ab. This is only pos‐
1633 sible if the builtin is not yet loaded. -i suppresses
1634 the error if the builtin is already removed (or never
1635 existed).
1636
1637 zmodload -ac [ -IL ]
1638 zmodload -ac [ -iI ] name [ cond ... ]
1639 zmodload -uc [ -iI ] cond ...
1640 The -ac option is used to define autoloaded condition
1641 codes. The cond strings give the names of the conditions
1642 defined by the module. The optional -I option is used to
1643 define infix condition names. Without this option prefix
1644 condition names are defined.
1645
1646 If given no condition names, all defined names are listed
1647 (as a series of zmodload commands if the -L option is
1648 given).
1649
1650 The -uc option removes definitions for autoloaded condi‐
1651 tions.
1652
1653 zmodload -ap [ -L ]
1654 zmodload -ap [ -i ] name [ parameter ... ]
1655 zmodload -up [ -i ] parameter ...
1656 The -p option is like the -b and -c options, but makes
1657 zmodload work on autoloaded parameters instead.
1658
1659 zmodload -af [ -L ]
1660 zmodload -af [ -i ] name [ function ... ]
1661 zmodload -uf [ -i ] function ...
1662 The -f option is like the -b, -p, and -c options, but
1663 makes zmodload work on autoloaded math functions instead.
1664
1665 zmodload -a [ -L ]
1666 zmodload -a [ -i ] name [ builtin ... ]
1667 zmodload -ua [ -i ] builtin ...
1668 Equivalent to -ab and -ub.
1669
1670 zmodload -e [ -A ] [ string ... ]
1671 The -e option without arguments lists all loaded modules;
1672 if the -A option is also given, module aliases corre‐
1673 sponding to loaded modules are also shown. With argu‐
1674 ments only the return status is set to zero if all
1675 strings given as arguments are names of loaded modules
1676 and to one if at least on string is not the name of a
1677 loaded module. This can be used to test for the avail‐
1678 ability of things implemented by modules. In this case,
1679 any aliases are automatically resolved and the -A flag is
1680 not used.
1681
1682 zmodload -A [ -L ] [ modalias[=module] ... ]
1683 For each argument, if both modalias and module are given,
1684 define modalias to be an alias for the module module. If
1685 the module modalias is ever subsequently requested,
1686 either via a call to zmodload or implicitly, the shell
1687 will attempt to load module instead. If module is not
1688 given, show the definition of modalias. If no arguments
1689 are given, list all defined module aliases. When list‐
1690 ing, if the -L flag was also given, list the definition
1691 as a zmodload command to recreate the alias.
1692
1693 The existence of aliases for modules is completely inde‐
1694 pendent of whether the name resolved is actually loaded
1695 as a module: while the alias exists, loading and unload‐
1696 ing the module under any alias has exactly the same
1697 effect as using the resolved name, and does not affect
1698 the connection between the alias and the resolved name
1699 which can be removed either by zmodload -R or by redefin‐
1700 ing the alias. Chains of aliases (i.e. where the first
1701 resolved name is itself an alias) are valid so long as
1702 these are not circular. As the aliases take the same
1703 format as module names, they may include path separators:
1704 in this case, there is no requirement for any part of the
1705 path named to exist as the alias will be resolved first.
1706 For example, `any/old/alias' is always a valid alias.
1707
1708 Dependencies added to aliased modules are actually added
1709 to the resolved module; these remain if the alias is
1710 removed. It is valid to create an alias whose name is
1711 one of the standard shell modules and which resolves to a
1712 different module. However, if a module has dependencies,
1713 it will not be possible to use the module name as an
1714 alias as the module will already be marked as a loadable
1715 module in its own right.
1716
1717 Apart from the above, aliases can be used in the zmodload
1718 command anywhere module names are required. However,
1719 aliases will not be shown in lists of loaded modules with
1720 a bare `zmodload'.
1721
1722 zmodload -R modalias ...
1723 For each modalias argument that was previously defined as
1724 a module alias via zmodload -A, delete the alias. If any
1725 was not defined, an error is caused and the remainder of
1726 the line is ignored.
1727
1728 Note that zsh makes no distinction between modules that were
1729 linked into the shell and modules that are loaded dynamically.
1730 In both cases this builtin command has to be used to make avail‐
1731 able the builtins and other things defined by modules (unless
1732 the module is autoloaded on these definitions). This is true
1733 even for systems that don't support dynamic loading of modules.
1734
1735 zparseopts
1736 See the section `The zsh/zutil Module' in zshmodules(1).
1737
1738 zprof See the section `The zsh/zprof Module' in zshmodules(1).
1739
1740 zpty See the section `The zsh/zpty Module' in zshmodules(1).
1741
1742 zregexparse
1743 See the section `The zsh/zutil Module' in zshmodules(1).
1744
1745 zsocket
1746 See the section `The zsh/net/socket Module' in zshmodules(1).
1747
1748 zstyle See the section `The zsh/zutil Module' in zshmodules(1).
1749
1750 ztcp See the section `The zsh/net/tcp Module' in zshmodules(1).
1751
1752
1753
1754zsh 4.2.6 November 28, 2005 ZSHBUILTINS(1)